TypeError: entry_points() got an unexpected keyword argument 'group' (Tensor2Tensor on Mac)

1.2k views Asked by At

I'm currently trying to work with Tensor2Tensor (1.15.7) on an M1 MacBook and running into some issues that I'm struggling to solve. I'm using a miniconda environment with Python 3.8, tensorflow-macos 2.10.0, and tensorflow-metal 0.6.0.

Using importlib-metadata version 4.12.0 and protobuf 3.20.0 and running t2t-trainer --registry_help gives me this error:

Traceback (most recent call last):
  File "/Users/me/opt/miniconda3/envs/test/bin/t2t-trainer", line 23, in <module>
    from tensor2tensor.bin import t2t_trainer
  File "/Users/me/opt/miniconda3/envs/test/lib/python3.8/site-packages/tensor2tensor/bin/t2t_trainer.py", line 24, in <module>
    from tensor2tensor import models  # pylint: disable=unused-import
  File "/Users/me/opt/miniconda3/envs/test/lib/python3.8/site-packages/tensor2tensor/models/__init__.py", line 51, in <module>
    from tensor2tensor.models.research import rl
  File "/Users/me/opt/miniconda3/envs/test/lib/python3.8/site-packages/tensor2tensor/models/research/rl.py", line 21, in <module>
    import gym
  File "/Users/me/opt/miniconda3/envs/test/lib/python3.8/site-packages/gym/__init__.py", line 15, in <module>
    from gym.envs import make, spec, register
  File "/Users/me/opt/miniconda3/envs/test/lib/python3.8/site-packages/gym/envs/__init__.py", line 5, in <module>
    _load_env_plugins()
  File "/Users/me/opt/miniconda3/envs/test/lib/python3.8/site-packages/gym/envs/registration.py", line 268, in load_env_plugins
    for plugin in metadata.entry_points(group=entry_point):
TypeError: entry_points() got an unexpected keyword argument 'group'

If I upgrade protobuf to 4.21.6 I get:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow-metadata 1.10.0 requires protobuf<4,>=3.13, but you have protobuf 4.21.6 which is incompatible.
tensorflow-macos 2.10.0 requires protobuf<3.20,>=3.9.2, but you have protobuf 4.21.6 which is incompatible.
tensorboard 2.10.1 requires protobuf<3.20,>=3.9.2, but you have protobuf 4.21.6 which is incompatible.

and running t2t-trainer --registry_help gives this error:

 File "/Users/me/opt/miniconda3/envs/test/lib/python3.8/site-packages/google/protobuf/descriptor.py", line 560, 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).

I hope I've asked outlined my issues properly, please do let me know if anything is unclear. I'm quite new to Python (mainly use JavaScript) so would appreciate any help. Thanks.

0

There are 0 answers