Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Descriptors cannot be created directly #757

Open
jshn9515 opened this issue Jan 15, 2024 · 0 comments
Open

Descriptors cannot be created directly #757

jshn9515 opened this issue Jan 15, 2024 · 0 comments

Comments

@jshn9515
Copy link

When I try to import siphon.cdmr.dataset, I receive this error:

TypeError: Descriptors cannot 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).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

My protobuf package is 4.25.2.
It can be fixed by either downgrading the protobuf package to 3.20.0 or adding these codes before the import statement:

import google.protobuf.internal.api_implementation as api
api._implementation_type = 'python'

import siphon.cdmr.dataset as dataset  # now everything works fine.

But according to protobuf docs, this API is not recommend to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant