google-deepmind / google-deepmind/pysc2

TypeError: Descriptors cannot not be created directly.

Open
#355 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
8.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I'm getting this error when trying to use pysc2. This happens with both the pip install and trying to use it from git.

cli command:

```
pysc2_replay_info --replay ~/replays/15467fbf7779f05d783c8b384411dfeb.SC2Replay
```

traceback:

```
Traceback (most recent call last):
File "/home/ashley/.local/bin/pysc2_replay_info", line 5, in
from pysc2.bin.replay_info import entry_point
File "/home/ashley/.local/pipx/venvs/pysc2/lib/python3.11/site-packages/pysc2/bin/replay_info.py", line 22, in
from pysc2 import run_configs
File "/home/ashley/.local/pipx/venvs/pysc2/lib/python3.11/site-packages/pysc2/run_configs/__init__.py", line 18, in
from pysc2.lib import sc_process
File "/home/ashley/.local/pipx/venvs/pysc2/lib/python3.11/site-packages/pysc2/lib/sc_process.py", line 27, in
from pysc2.lib import remote_controller
File "/home/ashley/.local/pipx/venvs/pysc2/lib/python3.11/site-packages/pysc2/lib/remote_controller.py", line 24, in
from pysc2.lib import protocol
File "/home/ashley/.local/pipx/venvs/pysc2/lib/python3.11/site-packages/pysc2/lib/protocol.py", line 29, in
from s2clientprotocol import sc2api_pb2 as sc_pb
File "/home/ashley/.local/pipx/venvs/pysc2/lib/python3.11/site-packages/s2clientprotocol/sc2api_pb2.py", line 17, in
from s2clientprotocol import common_pb2 as s2clientprotocol_dot_common__pb2
File "/home/ashley/.local/pipx/venvs/pysc2/lib/python3.11/site-packages/s2clientprotocol/common_pb2.py", line 32, in
_descriptor.EnumValueDescriptor(
File "/home/ashley/.local/pipx/venvs/pysc2/lib/python3.11/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).

More information: https://developers.google.com/protocol-buffers/docs/news/2022-05-06#python-updates
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.