matsim-vsp / matsim-python-tools

Tools for working with matsim in python
57 stars 20 forks source link

Protobuf import error #18

Closed rakow closed 1 year ago

rakow commented 2 years ago

Fresh installation of matsim-tools throws this error:

Traceback (most recent call last):
 File "~/calibrate_MT_100.py", line 12, in <module>
  from matsim import calibration
 File "~/.local/lib/python3.9/site-packages/matsim/init.py", line 1, in <module>
  from . import Events, Network, Plans, TripEventHandler, writers
 File "~/.local/lib/python3.9/site-packages/matsim/[Events.py](https://events.py/)", line 10, in <module>
  from .pb.Ids_pb2 import ProtoId
 File "~/.local/lib/python3.9/site-packages/matsim/pb/Ids_pb2.py", line 31, in <module>
  _descriptor.EnumValueDescriptor(
 File "~/.local/lib/python3.9/site-packages/google/protobuf/[descriptor.py](https://descriptor.py/)", line 755, 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).
More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates

We might want to update the generated protobuf files.

rakow commented 1 year ago

Should be fixed now.