mapbox / mapbox/vector-tile-base

Protobuf TypeError: Descriptors cannot not be created directly.

Open
#23 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
57
Forks
16
PR merge metrics
No merged PRs in 30d

Description

```python
agri_data/tests/imperviousness/test_views.py:5: in
from vector_tile_base import VectorTile
/usr/local/lib/python3.9/site-packages/vector_tile_base/__init__.py:1: in
from . import engine
/usr/local/lib/python3.9/site-packages/vector_tile_base/engine.py:3: in
from . import vector_tile_pb2
/usr/local/lib/python3.9/site-packages/vector_tile_base/vector_tile_pb2.py:33: in
_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](https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
) 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](https://github.com/protocolbuffers/upb), 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.
> >>>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from agri_data/tests/imperviousness/test_views.py, then inspect vector_tile_base/vector_tile_pb2.py and the package's protobuf/protoc compatibility. Confirm the chosen compatibility path by rerunning the test and verifying that VectorTile imports without the descriptor TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.