为什么“pip install gym”失败,并出现“python setup.py egg_info did not run successfully”错误?

brc7rcf0  于 2023-05-19  发布在  Python
关注(0)|答案(1)|浏览(1357)

我正在努力安装健身房突然在谷歌可乐。
错误如下所示:

Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting gym[accept-rom-license,atari]==0.21.0
  Using cached gym-0.21.0.tar.gz (1.5 MB)
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  Preparing metadata (setup.py) ... error
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

我已经升级了pip和setuptools,并安装了ez_setup,但没有任何效果。

j91ykkif

j91ykkif1#

TL;DR降级setuptools==65.5.0wheel<0.40.0

!pip install setuptools==65.5.0 "wheel<0.40.0"

详情:

这里的问题似乎与wheel(0. 40. 0+)和setuptools(66. 0. 0+)有关,它们现在报告gym==0.21.0的安装文件中的版本字符串不再有效。以下追溯来自Github #3202 for gym中报告的Gym构建轮

...
wheel.vendored.packaging.requirements.InvalidRequirement: Expected end or semicolon (after version specifier)
opencv-python>=3.

它引用setup.py中的opencv-python>=3.字符串。看起来较新版本的wheel在这里引发了错误。
您可以在Github issue #3211中找到的一种解决方法是降级setuptools和wheel的版本,如下所示:

!pip install setuptools==65.5.0 "wheel<0.40.0"

重启内核后,你应该可以运行:

!pip install gym==0.21.0

相关问题