Open Nervoload opened 1 year ago
Have you run pip install "gym[accept-rom-license, atari]"
?
Could you print gym.envs.registration.registry.keys()
?
I have similar problem when making an environment through gym.make("ALE/Riverraid-v5"). I run both commands you suggested and the return for the print was:
dict_keys(['CartPole-v0', 'CartPole-v1', 'MountainCar-v0', 'MountainCarContinuous-v0', 'Pendulum-v1', 'Acrobot-v1', 'CartPoleJax-v0', 'CartPoleJax-v1', 'PendulumJax-v0', 'LunarLander-v2', 'LunarLanderContinuous-v2', 'BipedalWalker-v3', 'BipedalWalkerHardcore-v3', 'CarRacing-v2', 'Blackjack-v1', 'FrozenLake-v1', 'FrozenLake8x8-v1', 'CliffWalking-v0', 'Taxi-v3', 'Jax-Blackjack-v0', 'Reacher-v2', 'Reacher-v4', 'Pusher-v2', 'Pusher-v4', 'InvertedPendulum-v2', 'InvertedPendulum-v4', 'InvertedDoublePendulum-v2', 'InvertedDoublePendulum-v4', 'HalfCheetah-v2', 'HalfCheetah-v3', 'HalfCheetah-v4', 'Hopper-v2', 'Hopper-v3', 'Hopper-v4', 'Swimmer-v2', 'Swimmer-v3', 'Swimmer-v4', 'Walker2d-v2', 'Walker2d-v3', 'Walker2d-v4', 'Ant-v2', 'Ant-v3', 'Ant-v4', 'Humanoid-v2', 'Humanoid-v3', 'Humanoid-v4', 'HumanoidStandup-v2', 'HumanoidStandup-v4', 'GymV21Environment-v0', 'GymV26Environment-v0'])
@rezkanas You are using gymnasium not gym, and has an additional requirement, please run pip install gymnasium[atari, accept-rom-licesnse]
I'm also having a similar problem, but installing the gymnasium code above was not working for me. The error is pretty much exactly the same as the one from the original post, and I have the same keys as the person above as well. Is there any way you could help me?
Hey @pseudo-rnd-thoughts, I am having the same issue as @rezkanas, with the same keys, even after running the code you suggested. Can you please let us know what to do in this case?
If you are using gym then you need to run pip install "gym[atari, accept-rom-license]"
and if you are using gymnasium you need to run pip install "gymnasium[atari, accept-rom-license]"
.
If you have run the appropriate command then do
import gym # or "import gymnasium as gym"
print(gym.make("ALE/Pong-v5"))
and it doesn't work then run
import ale_py
# if using gymnasium
import shimmy
import gym # or "import gymnasium as gym"
print(gym.envs.registry.keys())
Just did the accept rom license for gymnasium, and still did not work. Here is the output for the keys: dict_keys(['CartPole-v0', 'CartPole-v1', 'MountainCar-v0', 'MountainCarContinuous-v0', 'Pendulum-v1', 'Acrobot-v1', 'LunarLander-v2', 'LunarLanderContinuous-v2', 'BipedalWalker-v3', 'BipedalWalkerHardcore-v3', 'CarRacing-v2', 'Blackjack-v1', 'FrozenLake-v1', 'FrozenLake8x8-v1', 'CliffWalking-v0', 'Taxi-v3', 'Reacher-v2', 'Reacher-v4', 'Pusher-v2', 'Pusher-v4', 'InvertedPendulum-v2', 'InvertedPendulum-v4', 'InvertedDoublePendulum-v2', 'InvertedDoublePendulum-v4', 'HalfCheetah-v2', 'HalfCheetah-v3', 'HalfCheetah-v4', 'Hopper-v2', 'Hopper-v3', 'Hopper-v4', 'Swimmer-v2', 'Swimmer-v3', 'Swimmer-v4', 'Walker2d-v2', 'Walker2d-v3', 'Walker2d-v4', 'Ant-v2', 'Ant-v3', 'Ant-v4', 'Humanoid-v2', 'Humanoid-v3', 'Humanoid-v4', 'HumanoidStandup-v2', 'HumanoidStandup-v4', 'GymV26Environment-v0'])
Hey @pseudo-rnd-thoughts, Thanks a lot, you are a real saviour 🥳 Hey @OwenFa, try using what Mark has suggested above, it worked in my environment (gymnasium with version 0.28.1). I really hope that it works in yours as well 😄
@OwenFa Did you do the import ale_py
and import shimmy
did these work?
Are you using gymnasium from pip or a git cloned version locally?
The solutions Mark suggested didn't work for Python 3.8. But I created a new environment with 3.7 and installed "gym[accept-rom-license, atari]" and Breakout now works fine.
I get the same error with gymnasium but not gym.
To give a little bit of context, it's a distributed script where submitit is used to spawn jobs on multiple nodes that all create their own copies of a gym env and send data to the main node asynchronously.
If I create a "ALE/Pong-v5" on the main node it works, but spawn processes cannot.
With gym it's working fine.
To reproduce: on https://github.com/pytorch/rl/pull/1672, execute rl/examples/distributed/collectors/multi_nodes/delayed_dist.py
. Replacing the backend in that script with gymnasium
leads to the error reported in this issue on the distant nodes.
I know this issue is basically closed but if you are using gym in a jupyter notebook test it in a normal python file. My environment loaded in everything correctly in normal python.
If someone is still having issues with gymnasium, i just deactivated and activated my virtual environment(venv) again and it fixed things for me. If you are using jupyter notebook in vscode, switching to different kernel server and then going back to original kernel server again fixed the issue.
Thanks, I did all of the above but it was still showing the same error. I restarted the colab notebook (with the above fixes) and it worked!
I followed all the steps mentioned above, but the error persisted. For anyone facing the same issue, try creating a new virtual environment and then running pip install gym[all,accept-rom-license]
in that env instead of gym[atari,accept-rom-license]
. This solution worked for me—hope it helps!
I am attempting to access the Atari environments, and upon importing the latest versions of ale-py, autorom, gym, gymnasium even, I get the following error when attempting to make and environment of any space under the ALE namespace:
env = gym.make(ALE/Breakout-v5)
NamespaceNotFound Traceback (most recent call last) in
1 env_name = 'ALE/Breakout-v5'
----> 2 env = gym.make(env_name)
4 frames /usr/local/lib/python3.9/dist-packages/gym/envs/registration.py in _assert_namespace_exists(self, namespace) 266 else: 267 message += f" Have you installed the proper package for
{namespace}
?" --> 268 raise error.NamespaceNotFound(message) 269 270 def _assert_name_exists(self, namespace: Optional[str], name: str) -> None:NamespaceNotFound: Namespace
ALE
does not exist. Have you installed the proper package forALE
?Yes, I did in fact download namespace ALE.
This may be a notebook exclusive error, but it did happen on my personal base python3.10. Somehow, after reinstalling and changing a bunch of packages, I actually got it to work on my personal computer.
I suspect that gym.make pulls from existing files under gym/envs, and somehow the ALE package does not reroute the directory when attaching the namespace to it. I will play with this to try to figure out the solution by added the ALE roms to the gym/envs folder, or by changing the namespaces directly.
gym version: 0.28.1
System Info Describe the characteristic of your environment: ipynb, notebook =