googleapis / python-bigquery-storage

Apache License 2.0
116 stars 46 forks source link

Descriptors cannot not be created directly #581

Closed shashanksahay8 closed 10 months ago

shashanksahay8 commented 1 year ago

I am using google.cloud.bigquery_storage_v1 library to retrieve and insert data into big query. I understand that installing this library forces an automatic install of google protobuf to the latest version (4.22.1 in this case). Once this is done and I try to generate my protobuf file using protoc. However, on running the program I get an error saying "Descriptors cannot not be created directly. If this call came from a _pb2.py file, your generated code is out of date and must be regenerated with protoc >= 3.19.0. If you cannot immediately regenerate your protos, some other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

I do not want to use pure python parsing, since that voids the purpose of using this library for me. I did downgrade the version of protobuf but it does not seem to work as required since downgrading protobuf overwrites the google.cloud package and my code isn't able to find the storage APIs thereafter.

Environment details

Thanks!

shollyman commented 1 year ago

Can you provide more reproduction details? This is a library and we're missing details about your specific usages here.

shashanksahay8 commented 1 year ago

To reproduce this issue:

  1. Create virtual environment
  2. run pip install google-cloud-bigquery-storage==2.18.1
  3. create a .proto file, example : message exampleProto{ string id = 1; string name = 2; float class = 3; }
  4. generate protobuf using protoc -I=. --python_out=. exampleProto.proto
  5. Try importing the generate file in a flask blueprint
chalmerlowe commented 10 months ago

This appears to be a very specific use case with limited impact. Due to staffing and workloads, I am marking this as will not fix.