当前位置 : 主页 > 编程语言 > python >

Gym Atari: Gym no longer distributes ROMs.

来源:互联网 收集:自由互联 发布时间:2022-06-15
本文 主要环境版本:python:3.7, gym: 0.23.0, atari-py: 1.2.2 在为Gym安装Atari游戏环境支持的时候,遇到如下报错: f’We’re Unable to find the game “{self._game}”. Note: Gym no longer distributes ROMs. ’ g


本文主要环境版本:python:3.7, gym: 0.23.0, atari-py: 1.2.2

在为Gym安装Atari游戏环境支持的时候,遇到如下报错:

f’We’re Unable to find the game “{self._game}”. Note: Gym no longer distributes ROMs. ’

gym.error.Error: We’re Unable to find the game “Breakout”. Note: Gym no longer distributes ROMs. If you own a license to use the necessary ROMs for research purposes you can download them via ​​pip install gym[accept-rom-license]​​. Otherwise, you should try importing “Breakout” via the command ​​ale-import-roms​​. If you believe this is a mistake perhaps your copy of “Breakout” is unsupported. To check if this is the case try providing the environment variable ​​PYTHONWARNINGS=default::ImportWarning:ale_py.roms​​. For more information see: https://github.com/mgbellemare/Arcade-Learning-Environment#rom-management

主要原因是Gym在某个版本,将一些环境剥离开了,Gym no longer distributes ROMs,Gym不在统一管理Roms了,为解决这个问题,主要有两个方法:

  • 版本回退,gym版本回退至0.19.0,Atari版本回退为0.2.6,执行如下两条命令:
  • pip install gym==0.19.0
    pip install atari_py==0.2.6
  • 按照提示,安装Arcade-Learning-Environment,遇到问题不能总是回退版本嘛不是,还是要体验新版本的特性的嘛。
  • 不过按照Arcade-Learning-Environment ​​github页面​​上的提示,我折腾了半天,愣是不知道怎么做,坑啊。下面来说下解决方案:

    到Atari的[网站](​​Atari 2600 VCS ROM Collection (atarimania.com)​​)上去下载Roms,下载2600个游戏的rom,下载的文件是Roms.zip。

    如果下载速度过慢,可以到这个​​链接下载​​.

    将压缩包解压,在命令行进入刚才的解压目录的上一层,执行如下命令:

    Gym Atari: Gym no longer distributes ROMs._gym

    ale-import-roms ROMS/

    执行结果如下图所示,导入的游戏数量是看你的环境是否支持的,我电脑上只导入了110个。


    Gym Atari: Gym no longer distributes ROMs._版本回退_02


    再次执行代码,就不报这个错误了。

    如果你发现报如下错误:

    from gym.envs.classic_control import rendering
    ImportError: cannot import name 'rendering' from 'gym.envs.classic_control' (/home/lizishu/anaconda3/envs/GymSecond/lib/python3.7/site-packages/gym/envs/classic_control/__init__.py)

    ​ 可以去看下这篇​​文章​​。


    本文的内容到这里就结束了,这也是我学习强化学习环境遇到的第一个大的坑,反反复复折腾了两天。本文内容全部都是由博主自己进行整理并结合自身的理解进行总结,如果有什么错误,还请批评指正。

    如果本文能对你有所帮助,还请给点赞、收藏、关注博主。



    上一篇:Gym安装Atari环境(Windows,Linux适用)
    下一篇:没有了
    网友评论