Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Descriptors cannot not be created directly. #355

Open
expenses opened this issue Sep 3, 2023 · 4 comments
Open

TypeError: Descriptors cannot not be created directly. #355

expenses opened this issue Sep 3, 2023 · 4 comments

Comments

@expenses
Copy link

expenses commented Sep 3, 2023

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 <module>
    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 <module>
    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 <module>
    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 <module>
    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 <module>
    from pysc2.lib import protocol
  File "/home/ashley/.local/pipx/venvs/pysc2/lib/python3.11/site-packages/pysc2/lib/protocol.py", line 29, in <module>
    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 <module>
    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 <module>
    _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
@HTensor
Copy link

HTensor commented Sep 30, 2023

same problem.

@flyingicedragon
Copy link

I met this problem at the first time too. Using python 3.9 and protobuf 3.19.6 can solve it.

@ChinChangYang
Copy link

To be more specific, this works to me:

pip install protobuf==3.20.0

@gabrielgcbs
Copy link

To be more specific, this works to me:

pip install protobuf==3.20.0

This has also solved my problem! Using python 3.10.5 and pysc2 4.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants