03-09-2023, 11:29 PM
Hello,
I am trying to use the API for the first time, and trying to install modules
Using this stackoverflow, I downgraded to 3.20.3 and the error went away.
If possible, you should make the API compatible with the latest packages.
I am trying to use the API for the first time, and trying to install modules
google
and protobuf
using pip3 install
, I came across the following error:Traceback (most recent call last):
File "oap-bm2-inject.py", line 13, in <module>
import common.Api_pb2 as oap_api
File "/home/pi/bm2-oap/common/Api_pb2.py", line 37, in <module>
create_key=_descriptor._internal_create_key),
File "/home/pi/.local/lib/python3.7/site-packages/google/protobuf/descriptor.py", line 796, in __new__
_message.Message._CheckCalledFromGeneratedFile()
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).
Using this stackoverflow, I downgraded to 3.20.3 and the error went away.
If possible, you should make the API compatible with the latest packages.