By accident I updated protobuf
on my Ubuntu vps. Now some very essential Python scripts don't work anymore. Speed isn't really important. I got two solutions:
TypeError: 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).
Downgrade the protobuf
package, not sure it that's the way forward
or Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
- but where do I set this. In the python script?
pip install protobuf==3.20.*
Note: the *
above is not to be taken literally, it's called a "wildcard". You put your own number in there as needed, as in 3.20.1
, 3.20.5
, etc.
This is similar to TypeError: Descriptors cannot not be created directly
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With