protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Couldn't build proto file into descriptor pool: duplicate symbol - google.cloud.aiplatform

Open LVC-collab opened this issue 1 year ago • 7 comments

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?

  1. Attempted to run my Flask application using Google Cloud's aiplatform package.
  2. 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

Screenshot 2024-10-09 184238

code.txt

LVC-collab avatar Oct 09 '24 13:10 LVC-collab

@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.

JasonLunn avatar Oct 11 '24 21:10 JasonLunn

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 avatar Oct 16 '24 14:10 DamyanBG

@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 avatar Oct 18 '24 14:10 JasonLunn

@JasonLunn yes, here is a repo, where you can see error using Python 3.13.0 and works on Python 3.12.6:

Repo

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

DamyanBG avatar Oct 18 '24 20:10 DamyanBG

I opened issue in google-cloud-aiplatform also - googleapis/python-aiplatform#4557

DamyanBG avatar Oct 18 '24 20:10 DamyanBG

Someone else reported this on Stackoverflow: https://stackoverflow.com/q/79103765/7483211

It seems trivial to reproduce:

  1. Install Python 3.13
  2. Install an protobuf version 5.28.2
  3. from google.cloud import compute_v1
  4. See error

Maybe you can run your CI on Python 3.13 as well?

corneliusroemer avatar Oct 18 '24 22:10 corneliusroemer

@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!

LVC-collab avatar Oct 19 '24 06:10 LVC-collab

dupe of https://github.com/googleapis/proto-plus-python/issues/490 -- fixed by upgrading proto-plus

asottile-sentry avatar Nov 12 '24 17:11 asottile-sentry

Very good, I think this issue can be closed.

DamyanBG avatar Nov 14 '24 19:11 DamyanBG

Indeed, I can confirm the issue has been fixed in protobuf 5.28.3

@JasonLunn you can close this

corneliusroemer avatar Nov 18 '24 12:11 corneliusroemer