Couldn't build proto file into descriptor pool: duplicate symbol - google.cloud.aiplatform
What version of protobuf and what language are you using? Version: 5.28.2 Language: Python
What operating system (Linux, Windows, ...) and version? Windows 11
What runtime / compiler are you using (e.g., python version or gcc version) Python 3.13.0
What did you do?
- Attempted to run my Flask application using Google Cloud's aiplatform package.
- Encountered a TypeError related to proto file descriptor conflicts.
What did you expect to see Expected the Flask application to run without errors.
What did you see instead? TypeError: Couldn't build proto file into descriptor pool: duplicate symbol 'google.cloud.aiplatform.v1beta1.ExplanationMetadata.InputMetadata.Visualization.firstlineno'
Anything else we should know about your project / environment I'm using the Flask framework to interact with Google Cloud's AI Platform (for text embedding). The issue seems related to conflicts in proto files when importing multiple versions of the same message. Flask code attached
@LVC-collab - can you elaborate on why you're trying to have multiple versions of the same message? That's not a typical supported use case.
Hello @JasonLunn ,
I am experiencing the same error right now. Instead of Flask, I am using FastAPI. I can not understand for now - is it a google library problem or protobuf problem.
What you can give us as solution? For example - I just follow the official documentation for using google libraries to interact with Vertex AI.
PS: I found that it is related to the Python version. With Python v3.12.5 on Windows machine I do not have this problem.
@DamyanBG - can you provide a test or a series of steps we can reproduce that works on Python 3.12 but fails on Python 3.13?
@JasonLunn yes, here is a repo, where you can see error using Python 3.13.0 and works on Python 3.12.6:
Build the image with Python 3.13.0 and you can see there is an error connected to protobuf library. I want to mention that you do not need to setup Google Cloud project, just start the container and you will see the error. On the other hand, you can build and start the container with Python 3.12.6 and you will see other error - it is connected that there are no credentials.
If you want, of course you can start free GCP project and make everything correct. Here is the official quickstart documentation
I opened issue in google-cloud-aiplatform also - googleapis/python-aiplatform#4557
Someone else reported this on Stackoverflow: https://stackoverflow.com/q/79103765/7483211
It seems trivial to reproduce:
- Install Python 3.13
- Install an protobuf version 5.28.2
from google.cloud import compute_v1- See error
Maybe you can run your CI on Python 3.13 as well?
@LVC-collab - can you elaborate on why you're trying to have multiple versions of the same message? That's not a typical supported use case.
I didn't do it intentionally. But that seems to be the error. I was not able to detect why/where it was happening. Any suggestions would be of great help!
dupe of https://github.com/googleapis/proto-plus-python/issues/490 -- fixed by upgrading proto-plus
Very good, I think this issue can be closed.
Indeed, I can confirm the issue has been fixed in protobuf 5.28.3
@JasonLunn you can close this