Skip to content

Protobuf TypeError: Descriptors cannot not be created directly. #23

@StefanBrand

Description

@StefanBrand
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions