TaoHuang13/hindsight-experience-replay-with-demo

gym.error.UnregisteredEnv

Closed this issue · 3 comments

Hello,

I have been running your code. I got an error that the environment is not registered properly within the openai Gym:

/home/yantian/Research/venv/bin/python /home/yantian/Research/hindsight-experience-replay-with-demo/train.py seed=1 task_name=NeedlePick-v0
workspace: /home/yantian/Research/hindsight-experience-replay-with-demo/exp_local/NeedlePick-v0/HerDemo/HerDemo_seed=1,task_name=NeedlePick-v0
Error executing job with overrides: ['seed=1', 'task_name=NeedlePick-v0']
Traceback (most recent call last):
File "/home/yantian/Research/venv/lib/python3.8/site-packages/gym/envs/registration.py", line 158, in spec
return self.env_specs[id]
KeyError: 'NeedlePick-v0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/yantian/Research/hindsight-experience-replay-with-demo/train.py", line 174, in main
exp = Experiment(cfg)
File "/home/yantian/Research/hindsight-experience-replay-with-demo/train.py", line 22, in init
self.setup(cfg)
File "/home/yantian/Research/hindsight-experience-replay-with-demo/train.py", line 41, in setup
self.train_env = gym.make(self.cfg.task_name)
File "/home/yantian/Research/venv/lib/python3.8/site-packages/gym/envs/registration.py", line 235, in make
return registry.make(id, **kwargs)
File "/home/yantian/Research/venv/lib/python3.8/site-packages/gym/envs/registration.py", line 128, in make
spec = self.spec(path)
File "/home/yantian/Research/venv/lib/python3.8/site-packages/gym/envs/registration.py", line 203, in spec
raise error.UnregisteredEnv("No registered env with id: {}".format(id))
gym.error.UnregisteredEnv: No registered env with id: NeedlePick-v0

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Thanks a lot!
Yantian

Hi Yantian,

Thanks for your information. Have you tried to register the SurRoL environment by following this step:

# directory: anaconda3/envs/dex/lib/python3.8/site-packages/
# Then add one line of code in gym/gym/envs/__init__.py to register SurRoL tasks:

import surrol.gym

Meanwhile, I'd like to suggest you look at the instructions in the DEX repo where more detailed descriptions will be given.

Please let me know if any further questions.

Thank you! I will take a look and get back to you soon.

Your solution of registering the SurRoL environment works. Thank you!