-
Notifications
You must be signed in to change notification settings - Fork 8.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug Report] AttributeError: module 'gym.envs.atari' has no attribute 'AtariEnv' #2648
Comments
Try installing ale-py as v5 uses a different backend module (ale-py) compared to v0 and v4 with atari-lib
|
@JesseFarebro Could you explain how atari is added to gym.envs.atari as isn't in the git repo Strangely, I have just installed gym to a new repository and am running into the same issue however last week as I was able to submit issue #2624 which had a different issue
|
We are using a somewhat obscure packaging feature in Python called namespace packages. The On install PyPi will place If you are experiencing any issues outside of editable mode feel free to post more info about your environment, e.g., Python version, distribution (pyenv, conda, etc.), OS, etc. You should also always try a fresh ls -l $(python -c 'import site; print(site.getsitepackages()[0])')/gym/envs/{atari,} |
Thanks, that explains the issue, I was using gym in editable mode |
I was having the same issue, and reinstalling
Hope this helps others. |
I have the same issue and also tried
|
@ZhihaoXu what does your local directory look like? Do you have a |
@JesseFarebro Thanks for your reply. I think my problem is related to the setup of the baselines package. After reinstalling the baselines, the problem is solved. |
Still somehow doesn't work on my end. |
@lebrice can you give me more information, e.g., what's the output of: ls -l $(python -c 'import site; print(site.getsitepackages()[0])')/gym/envs/{atari,}
|
Nevermind @JesseFarebro , At first I believed there was an older version of gym and/or ale-py in my pip cache. Here is my "test" of sorts to check if the installation process works. $ conda create -n temp-atari python=3.9
...
$ conda activate temp-atari
$ pip install gym[atari,accept-rom-license]
...
$ python -c "import gym; print(gym.make('Breakout-v0').reset().shape)"
/<some warning>
A.L.E: Arcade Learning Environment (version 0.7.5+db37282)
[Powered by Stella]
(210, 160, 3) All is good! Still, I wish it was possible to use the atari envs inside the gym repo! 🤔 |
runfile('C:/Users/liao/Desktop/CNNPong/untitled2.py', wdir='C:/Users/liao/Desktop/CNNPong') File "D:\Anaconda3\envs\tfgpu\lib\site-packages\spyder_kernels\py3compat.py", line 356, in compat_exec File "c:\users\liao\desktop\cnnpong\untitled2.py", line 9, in File "D:\Anaconda3\envs\tfgpu\lib\site-packages\gym\envs\registration.py", line 676, in make File "D:\Anaconda3\envs\tfgpu\lib\site-packages\gym\envs\registration.py", line 520, in make File "D:\Anaconda3\envs\tfgpu\lib\site-packages\gym\envs\registration.py", line 139, in make File "D:\Anaconda3\envs\tfgpu\lib\site-packages\gym\envs\registration.py", line 56, in load AttributeError: module 'gym.envs.atari' has no attribute 'AtariEnv' @JesseFarebro |
hi! bro ,Has your problem been solved I seem to have the same problem as you |
@2291924061 Could you run |
I tried to reinstall gym in the way you said, but it didn't help.This problem occurred when I installed the gym environment of 0.23.1.
|
@pseudo-rnd-thoughts I have used this environment to run gym 0.19, and it won't have this problem. But when I update gym, he will report this error |
@pseudo-rnd-thoughts I re created and activated an environment. After configuring the new version of gym, everything will be normal. But the previous environment still doesn't work properly |
What are your results from following @JesseFarebro suggestions? |
In shell mode, this sentence will not report this error. |
Could you also answer the other questions as well |
**_hello, i have almost the same problem with ALE namespace while trying to train a model on Colab by using these lines: train_env = suite_gym.load('ALE/SpaceInvaders-v5') and it show me this error message: DeprecatedEnv: Env ALE/SpaceInvaders-v5 not found (valid versions include ['SpaceInvaders-v0', 'SpaceInvaders-v4']) I have Gym Version: 0.17.3 |
also i have installed AutoROM-0.4.2
|
May I post in the closed issue or have to open a new one?
but after it i was solving another bug: tensorflow/agents#911
after that the bug AttributeError: 'AtariEnv' object has no attribute 'render_mode' returned and i can not solve it since. Additional info: Python version: (reinf_learning_hw2) C:\Users\satyr>python --version some magic command: ls -l $(python -c 'import site; print(site.getsitepackages()[0])')/gym/envs/{atari,} Full package list for conda virtual env: (reinf_learning_hw2) C:\Users\satyr>conda list |
After installing gym and gym[atari], the breakout doesn't work
`
import gym
env = gym.make("ALE/Breakout-v5")
observation = env.reset()
for _ in range(1000):
env.render()
action = env.action_space.sample() # your agent here (this takes random actions)
observation, reward, done, info = env.step(action)
if done:
observation = env.reset()
env.close()
Traceback (most recent call last):
File "/Users/haocheng/playground/PolicyGradient/main.py", line 2, in
env = gym.make("ALE/Breakout-v5")
File "/Users/haocheng/opt/anaconda3/envs/ML/lib/python3.7/site-packages/gym/envs/registration.py", line 676, in make
return registry.make(id, **kwargs)
File "/Users/haocheng/opt/anaconda3/envs/ML/lib/python3.7/site-packages/gym/envs/registration.py", line 520, in make
return spec.make(**kwargs)
File "/Users/haocheng/opt/anaconda3/envs/ML/lib/python3.7/site-packages/gym/envs/registration.py", line 139, in make
cls = load(self.entry_point)
File "/Users/haocheng/opt/anaconda3/envs/ML/lib/python3.7/site-packages/gym/envs/registration.py", line 56, in load
fn = getattr(mod, attr_name)
AttributeError: module 'gym.envs.atari' has no attribute 'AtariEnv'
The text was updated successfully, but these errors were encountered: