Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to downgrade protobuf

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?

like image 836
Arie Osdorp Avatar asked Sep 02 '25 02:09

Arie Osdorp


1 Answers

Downgrade protobuf using pip

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

like image 56
Dr.House Avatar answered Sep 06 '25 22:09

Dr.House