vector-tile-base
vector-tile-base copied to clipboard
Protobuf TypeError: Descriptors cannot not be created directly.
agri_data/tests/imperviousness/test_views.py:5: in <module>
from vector_tile_base import VectorTile
/usr/local/lib/python3.9/site-packages/vector_tile_base/__init__.py:1: in <module>
from . import engine
/usr/local/lib/python3.9/site-packages/vector_tile_base/engine.py:3: in <module>
from . import vector_tile_pb2
/usr/local/lib/python3.9/site-packages/vector_tile_base/vector_tile_pb2.py:33: in <module>
_descriptor.EnumValueDescriptor(
/usr/local/lib/python3.9/site-packages/google/protobuf/descriptor.py:755: in __new__
_message.Message._CheckCalledFromGeneratedFile()
E TypeError: Descriptors cannot not be created directly.
E 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.
E If you cannot immediately regenerate your protos, some other possible workarounds are:
E 1. Downgrade the protobuf package to 3.20.x or lower.
E 2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).
E
E More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
The protobuf
changelog says the following:
We made some changes in Python language support in Protocol Buffers. Version 4.21.0 is a new major version, following 3.20.1. The new version is based on the upb library, and offers significantly better parsing performance than previous releases, especially for large payloads. [...]
- Python upb requires generated code that has been generated from protoc 3.19.0 or newer.
FYI, if you need to use vector-tile-base you can specify protobuf>=3.0,<4.0
in your dependencies
https://github.com/developmentseed/timvt/blob/master/pyproject.toml#L43
For services I like to pin to exact versions like protobuf==3.20.1
.
Alternatively, here is a PR that updates vector-tile-base
: #24