Skip to content
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] Env_Specs attribute not found #3097

Closed
aaravnavani opened this issue Sep 25, 2022 · 3 comments
Closed

[Bug Report] Env_Specs attribute not found #3097

aaravnavani opened this issue Sep 25, 2022 · 3 comments

Comments

@aaravnavani
Copy link

aaravnavani commented Sep 25, 2022

Describe the bug
I am playing around with this repository and I keep getting this error when I run the training:

File "train.py", line 318, in <module>
   main()
 File "train.py", line 200, in main
   frame_skip=args.action_repeat
 File "/home/anavani/anaconda3/envs/rad/lib/python3.7/site-packages/dmc2gym/__init__.py", line 28, in make
   if not env_id in gym.envs.registry.env_specs:
AttributeError: 'dict' object has no attribute 'env_specs'

Code example
The error seems to be coming from this line in init.py of dmc2gym: if not env_id in gym.envs.registry.env_specs:

System Info

  • Dmc2Gym was installed with conda
  • I am using Ubuntu 22.04
  • Python version 3.7
@pseudo-rnd-thoughts
Copy link
Contributor

gym.envs.registry was previously a complex class that we replaced with a dictionary for simplicity.
The code should just need to be changed to if env_id not in gym.envs.registry

Delaunay added a commit to Delaunay/bullet3 that referenced this issue Oct 13, 2022
Following a change inside the gym API, environment registration needs to be updated see (openai/gym#3097)
@Chengyui
Copy link

I solved this error throught degrading the version of Gym from 0.26.0 to 0.19.0

andrewtheiss added a commit to andrewtheiss/huggingface_sb3 that referenced this issue May 13, 2023
Update to gym has altered gym.envs.registry to a dictionary.  The change alters behavior on the initial huggingface.co Unit1 tutorial if not using Google CoLab.

Reproduce using WSL windows 10 ubuntu 
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.1 LTS
Release:        22.04

To Reproduce:
Follow tutorial on Unit1 as defined...


>>> package_to_hub(model=model, model_name=model_name,model_architecture=model_architecture,env_id=env_id,eval_env=eval_env,repo_id=repo_id,commit_message=commit_message)
ℹ This function will save, evaluate, generate a video of your agent,
create a model card and push everything to the hub. It might take up to 1min.
This is a work in progress: if you encounter a bug, please open an issue.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/theiss/.local/lib/python3.10/site-packages/huggingface_sb3/push_to_hub.py", line 364, in package_to_hub
    is_deterministic = not is_atari(env_id)
  File "/home/theiss/.local/lib/python3.10/site-packages/huggingface_sb3/push_to_hub.py", line 104, in is_atari
    entry_point = gym.envs.registry[env_id].entry_point
AttributeError: 'dict' object has no attribute 'env_specs'
 



Similar to issue mentioned: 
File "/home/anavani/anaconda3/envs/rad/lib/python3.7/site-packages/dmc2gym/__init__.py", line 28, in make
   if not env_id in gym.envs.registry.env_specs:
AttributeError: 'dict' object has no attribute 'env_specs'

openai/gym#3097
@rickstaa
Copy link

rickstaa commented May 30, 2023

For future reference, this change was implemented in #2748 and released under https://github.com/openai/gym/releases/tag/0.24.0.

rickstaa added a commit to rickstaa/stable-gym that referenced this issue May 30, 2023
This commit fixes the 'env_spec' not found bug that was thrown when
importing the simzoo environment in gym>=0.24.0 (see
openai/gym#3097).
rickstaa added a commit to rickstaa/stable-gym that referenced this issue May 30, 2023
This commit fixes the 'env_spec' not found bug that was thrown when
importing the simzoo environment in gym>=0.24.0 (see
openai/gym#3097).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants