facebookresearch / diplomacy_cicero

Code for Cicero, an AI agent that plays the game of Diplomacy with open-domain natural language negotiation.
Other
1.28k stars 157 forks source link

ModuleNotFoundError: No module named 'mypy_protobuf' after installation of package with anaconda on Ubuntu 22.04 #4

Closed wanfuse123 closed 1 year ago

wanfuse123 commented 1 year ago

pip install -e . -vv

Editable install will be performed using a meta path finder.

Options like package-data, include/exclude-package-data or packages.find.exclude/include may have no effect.

adding 'editable___fairdiplomacy_0_1_finder.py' adding 'editable__.fairdiplomacy-0.1.pth' creating '/tmp/pip-wheel-zhel742h/.tmp-_2fxpx0h/fairdiplomacy-0.1-0.editable-py3-none-any.whl' and adding '/tmp/tmpk9p2w7r0fairdiplomacy-0.1-0.editable-py3-none-any.whl' to it adding 'fairdiplomacy-0.1.dist-info/LICENSE.md' adding 'fairdiplomacy-0.1.dist-info/METADATA' adding 'fairdiplomacy-0.1.dist-info/WHEEL' adding 'fairdiplomacy-0.1.dist-info/entry_points.txt' adding 'fairdiplomacy-0.1.dist-info/top_level.txt' adding 'fairdiplomacy-0.1.dist-info/RECORD' /tmp/pip-build-env-t5yg3_ee/overlay/lib/python3.7/site-packages/setuptools/command/editable_wheel.py:510: InformationOnly:

      Please be careful with folders in your working directory with the same
      name as your package as they may take precedence during imports.

warnings.warn(msg, InformationOnly)

Traceback (most recent call last): File "/home/steven/anaconda3/envs/diplomacy_cicero/bin/protoc-gen-mypy", line 6, in from mypy_protobuf.main import main ModuleNotFoundError: No module named 'mypy_protobuf' --mypy_out: protoc-gen-mypy: Plugin failed with status code 1. Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/subprocess.py", line 512, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['protoc', 'conf/misc.proto', 'conf/agents.proto', 'conf/common.proto', 'conf/conf.proto', '--python_out', './', '--mypy_out', './']' returned non-zero exit status 1. Building editable for fairdiplomacy (pyproject.toml) ... done Created wheel for fairdiplomacy: filename=fairdiplomacy-0.1-0.editable-py3-none-any.whl size=4249 sha256=26f9971fcecdbef316808c34d220277c06377408cd34e7b33269348f48308ade Stored in directory: /tmp/pip-ephem-wheel-cache-8m0x90ua/wheels/27/20/0d/c667b968afca957a8928a45e7da98e9f441b9ac3cef02791ca Successfully built fairdiplomacy Installing collected packages: mypy-protobuf, fairdiplomacy Attempting uninstall: mypy-protobuf Found existing installation: mypy-protobuf 3.1.0 Uninstalling mypy-protobuf-3.1.0: Created temporary directory: /tmp/pip-uninstall-kx9oibwo Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/bin/protoc-gen-mypy Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/bin/protoc-gen-mypy_grpc Created temporary directory: /home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/site-packages/~ypy_protobuf-3.1.0.dist-info Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/site-packages/mypy_protobuf-3.1.0.dist-info/ Created temporary directory: /home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/site-packages/~ypy_protobuf Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/site-packages/mypy_protobuf/ Successfully uninstalled mypy-protobuf-3.1.0

changing mode of /home/steven/anaconda3/envs/diplomacy_cicero/bin/protoc-gen-mypy to 775 changing mode of /home/steven/anaconda3/envs/diplomacy_cicero/bin/protoc-gen-mypy_grpc to 775 Attempting uninstall: fairdiplomacy Found existing installation: fairdiplomacy 0.1 Uninstalling fairdiplomacy-0.1: Created temporary directory: /tmp/pip-uninstall-bsrfkrbm Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/bin/diplom Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/bin/parlai-sweep Created temporary directory: /tmp/pip-uninstall-g93zu40b Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/site-packages/editable.fairdiplomacy-0.1.pth Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/site-packages/editable_fairdiplomacy_0_1_finder.py Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/site-packages/pycache/editable_fairdiplomacy_0_1_finder.cpython-37.pyc Created temporary directory: /home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/site-packages/~airdiplomacy-0.1.dist-info Removing file or directory /home/steven/anaconda3/envs/diplomacy_cicero/lib/python3.7/site-packages/fairdiplomacy-0.1.dist-info/ Successfully uninstalled fairdiplomacy-0.1

changing mode of /home/steven/anaconda3/envs/diplomacy_cicero/bin/diplom to 775 changing mode of /home/steven/anaconda3/envs/diplomacy_cicero/bin/parlai-sweep to 775 Successfully installed fairdiplomacy-0.1 mypy-protobuf-2.10 Remote version of pip: 22.3.1 Local version of pip: 22.2.2 Was pip installed by pip? False Removed build tracker: '/tmp/pip-build-tracker-j1y_8jvg'

hirokinko commented 1 year ago

This error also occurred in my environment. Perhaps it is because this subprocess does not see the mypy-protobuf in the virtual environment.

So I commented out the _post_install() function in setup.py and ran pip install -e . -vv followed by make protos to generate the mypy stubs.

c-flaherty commented 1 year ago

Closing since @hirokinko mentioned a workaround for what seems to be an environment-specific issue.