为什么“pip install gym”失败并出现“python setup.py egg_info 未成功运行”错误?

问题描述 投票:0回答:1

我正在努力在 Google Colab 中突然安装健身房。

错误看起来像这样:

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,但没有任何效果。

python-3.x google-colaboratory openai-gym
1个回答
0
投票

TL;博士 降级你的

setuptools==65.5.0
wheel<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
安装文件中的版本字符串不再有效。以下回溯来自 building wheel for Gym,如 Github #3202 for gym

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

指的是

opencv-python>=3.
setup.py中的字符串。看起来较新版本的
wheel
在这里引发错误。

您可以在 Github issue #3211 中找到的一个解决方法是降级 setuptools 和 wheel 的版本,如:

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

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

!pip install gym==0.21.0
© www.soinside.com 2019 - 2024. All rights reserved.