Pip 找不到 ale-py 包

1 投票
1 回答
155 浏览
提问于 2025-04-14 17:06

我正在尝试在我的Windows电脑上使用OpenAI Gymnasium来构建游戏环境。我看到说需要安装ale-py才能使用这些游戏环境。但是,pip居然认为ale-py不存在???我是不是漏掉了什么?希望能得到一些帮助。下面是错误信息:

C:\Users\jarre>pip install ale-py
ERROR: Could not find a version that satisfies the requirement ale-py (from versions: none)
ERROR: No matching distribution found for ale-py

我还有一个额外的问题,就是在Gymnasium中安装Atari游戏环境时。当我尝试使用pip install gymnasium[atari]时,pip发现有多个版本之间有“冲突的依赖关系”,所以什么都安装不了。

Collecting gymnasium[atari]
  Using cached gymnasium-0.27.0-py3-none-any.whl.metadata (8.5 kB)
  Using cached Gymnasium-0.26.3-py3-none-any.whl.metadata (5.8 kB)
INFO: pip is looking at multiple versions of gymnasium[atari] to determine which version is compatible with other requirements. This could take a while.
  Using cached gymnasium-0.26.2-py3-none-any.whl.metadata (4.1 kB)
  Using cached gymnasium-0.26.1-py3-none-any.whl.metadata (4.1 kB)
ERROR: Cannot install gymnasium[atari]==0.26.1, gymnasium[atari]==0.26.2 and gymnasium[atari]==0.26.3 because these package versions have conflicting dependencies.

The conflict is caused by:
    gymnasium[atari] 0.26.3 depends on ale-py~=0.8.0; extra == "atari"
    gymnasium[atari] 0.26.2 depends on ale-py~=0.8.0; extra == "atari"
    gymnasium[atari] 0.26.1 depends on ale-py~=0.8.0; extra == "atari"

To fix this you could try to:
1. loosen the range of package versions you've specified
2. remove package versions to allow pip attempt to solve the dependency conflict

尝试使用pip install gym[atari]==0.19.0时,出现了setup.py egg_info的错误。

C:\Users\jarre>pip3 install gym[atari]==0.19.0
Collecting gym==0.19.0 (from gym[atari]==0.19.0)
  Using cached gym-0.19.0.tar.gz (1.6 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in gym setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
      [end of output]

我还尝试从https://github.com/Farama-Foundation/Arcade-Learning-Environment安装,但它显示“构建ale-py的轮子失败”。

1 个回答

3

Python包索引(PyPI)是pip用来下载各种包的地方。现在,ale-py和Python 3.12的组合在PyPI上没有可用的二进制版本。而且,ale-py在PyPI上也没有源代码的分发版本,所以pip也无法用这个来尝试在本地构建。

如果你使用Python 3.11而不是3.12,应该是可以正常工作的。

另外,你也可以等到3.12版本发布,或者在ale-py的问题跟踪器上询问一下3.12的二进制版本的状态(有时候,某些依赖关系会导致延迟,所以在这些依赖关系与3.12兼容之前,是无法完成的)。

撰写回答