Does Gym Atari still distribute ROMs for their games?

2026-05-28 12:591阅读0评论SEO教程
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计887个文字,预计阅读时间需要4分钟。

Does Gym Atari still distribute ROMs for their games?

在Gym环境中安装Atari游戏环境时,遇到以下错误信息:We're unable to find the game '{self._game}' + Note: Gym no longer distributes ROMs. 'g'。这通常是因为Gym不再提供ROM文件,你需要手动下载所需的ROM文件并放置在指定目录下。

以下是简化后的步骤:

1. 下载所需的Atari游戏ROM文件。

2.将ROM文件放置在本地环境中的指定路径,例如:`/path/to/your/roms/`。

3.在代码中指定ROM文件的路径。

示例代码(Python):

python

import gymfrom gym import spaces

设置游戏环境env=gym.make('Atari-v0', game='pong', rom='/path/to/your/roms/pong.bin')

定义动作空间action_space=spaces.Discrete(6)

定义观察空间observation_space=spaces.Box(low=0, high=255, shape=(210, 160, 3), dtype='uint8')

初始化环境env.reset()

执行动作action=env.action_space.sample()obs, reward, done, info=env.step(action)

检查是否完成if done: env.reset()


本文主要环境版本: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: 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。

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

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

    ale-import-roms ROMS/

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



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

    Does Gym Atari still distribute ROMs for their games?

    如果你发现报如下错误:

    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)

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


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

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



    本文共计887个文字,预计阅读时间需要4分钟。

    Does Gym Atari still distribute ROMs for their games?

    在Gym环境中安装Atari游戏环境时,遇到以下错误信息:We're unable to find the game '{self._game}' + Note: Gym no longer distributes ROMs. 'g'。这通常是因为Gym不再提供ROM文件,你需要手动下载所需的ROM文件并放置在指定目录下。

    以下是简化后的步骤:

    1. 下载所需的Atari游戏ROM文件。

    2.将ROM文件放置在本地环境中的指定路径,例如:`/path/to/your/roms/`。

    3.在代码中指定ROM文件的路径。

    示例代码(Python):

    python

    import gymfrom gym import spaces

    设置游戏环境env=gym.make('Atari-v0', game='pong', rom='/path/to/your/roms/pong.bin')

    定义动作空间action_space=spaces.Discrete(6)

    定义观察空间observation_space=spaces.Box(low=0, high=255, shape=(210, 160, 3), dtype='uint8')

    初始化环境env.reset()

    执行动作action=env.action_space.sample()obs, reward, done, info=env.step(action)

    检查是否完成if done: env.reset()


    本文主要环境版本: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: 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。

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

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

    ale-import-roms ROMS/

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



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

    Does Gym Atari still distribute ROMs for their games?

    如果你发现报如下错误:

    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)

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


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

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