huggingface / deep-rl-class

This repo contains the syllabus of the Hugging Face Deep Reinforcement Learning Course.
Apache License 2.0
3.89k stars 598 forks source link

Unit 3 - SpaceInvaders ROM #243

Closed lipeeeee closed 1 year ago

lipeeeee commented 1 year ago

When trying to run: !python train.py --algo dqn --env SpaceInvadersNoFrameskip-v4 -f logs/ to train the model I get an error from gym saying It cant get the rom, here is the traceback:


Traceback (most recent call last):
  File "/content/rl-baselines3-zoo/train.py", line 4, in <module>
    train()
  File "/content/rl-baselines3-zoo/rl_zoo3/train.py", line 265, in train
    results = exp_manager.setup_experiment()
  File "/content/rl-baselines3-zoo/rl_zoo3/exp_manager.py", line 190, in setup_experiment
    self.create_callbacks()
  File "/content/rl-baselines3-zoo/rl_zoo3/exp_manager.py", line 503, in create_callbacks
    self.create_envs(self.n_eval_envs, eval_env=True),
  File "/content/rl-baselines3-zoo/rl_zoo3/exp_manager.py", line 604, in create_envs
    env = make_vec_env(
  File "/usr/local/lib/python3.9/dist-packages/stable_baselines3/common/env_util.py", line 108, in make_vec_env
    return vec_env_cls([make_env(i + start_index) for i in range(n_envs)], **vec_env_kwargs)
  File "/usr/local/lib/python3.9/dist-packages/stable_baselines3/common/vec_env/dummy_vec_env.py", line 26, in __init__
    self.envs = [fn() for fn in env_fns]
  File "/usr/local/lib/python3.9/dist-packages/stable_baselines3/common/vec_env/dummy_vec_env.py", line 26, in <listcomp>
    self.envs = [fn() for fn in env_fns]
  File "/usr/local/lib/python3.9/dist-packages/stable_baselines3/common/env_util.py", line 85, in _init
    env = env_id(**env_kwargs)
  File "/content/rl-baselines3-zoo/rl_zoo3/exp_manager.py", line 599, in make_env
    env = spec.make(**kwargs)
  File "/usr/local/lib/python3.9/dist-packages/gym/envs/registration.py", line 90, in make
    env = cls(**_kwargs)
  File "/usr/local/lib/python3.9/dist-packages/gym/envs/atari/environment.py", line 123, in __init__
    self.seed()
  File "/usr/local/lib/python3.9/dist-packages/gym/envs/atari/environment.py", line 171, in seed
    raise error.Error(
gym.error.Error: We're Unable to find the game "SpaceInvaders". 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 "SpaceInvaders" via the command `ale-import-roms`. If you believe this is a mistake perhaps your copy of "SpaceInvaders" 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```
lipeeeee commented 1 year ago

I have ran !pip install gym[atari] to try and overcome this but every requirement has already been satisfied.

lipeeeee commented 1 year ago

problem was fixed by installing both gym[accept-rom-license] and gym[atari] before running the training code block