Why can't my custom OpenAI gym environment be found?

146 Views Asked by At

I am trying to create my custom gym environment. To do that, I took the following steps -

  1. I went over the documentation given over here.

  2. I cloned this repository.

  3. In the folder gym-examples/gym-examples, I created the file - my_test.py. The contents of the file are given over here -

import gym
env = gym.make('gym_examples/GridWorld-v0')
print("Did this work?")

However, when I try to run this file, I get the error -

File "D:\custom_env\gym-examples\my_test.py", line 2, in <module>
env = gym.make('gym_examples/GridWorld-v0')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\thoma\anaconda3\envs\env_torch\Lib\site-packages\gym\envs\registration.py", line 569, in make
_check_version_exists(ns, name, version)
File "C:\Users\thoma\anaconda3\envs\env_torch\Lib\site-packages\gym\envs\registration.py", line 219, in _check_version_exists
_check_name_exists(ns, name)
File "C:\Users\thoma\anaconda3\envs\env_torch\Lib\site-packages\gym\envs\registration.py", line 187, in _check_name_exists
_check_namespace_exists(ns)
File "C:\Users\thoma\anaconda3\envs\env_torch\Lib\site-packages\gym\envs\registration.py", line 182, in _check_namespace_exists
raise error.NamespaceNotFound(f"Namespace {ns} not found. {suggestion_msg}")
gym.error.NamespaceNotFound: Namespace gym_examples not found. Have you installed the proper package for gym_examples?

This is the structure of my directory -

enter image description here

0

There are 0 best solutions below