I am trying to register a custom gym environment on a remote server, but it is not working. I have been able to successfully register this environment on my personal computer using the Anaconda package manager framework, but have so far been unsuccesful without Anaconda (so I know the problem is not my environment). To try and work through this problem, I followed this tutorial .
Here is my file structure:
gym-knot
│ setup.py
│
└───gym_knot
│ __init__.py
│
└───envs
│ __init__.py
│ sliceenv.py
Where gym-knot/setup.py
is
from setup tools import setup
setup(name='gym_knot', version='0.0.1', install_requires=['gym']
gym-knot/gym_knot/__init__.py
is
from gym.envs.registration import register
register(
id='Slice-v0',
entry_point='gym_knot.envs:SliceEnv',
max_episode_steps=300,
reward_threshold=0,)
gym-knot/gym_knot/envs/__init__.py
is
from gym_knot.envs.sliceenv import SliceEnv
I then ran pip install --user -e gym-knot
to install it.
I have import gym_knot
in the python file with my algorithm.
When I use the command python3 knot_project.py
(which is the python file with my algorithm and whatnot), I get the error:
gym.error.NameNotFound: Environment 'gym_knot:Slice' doesn't exist.
I am really confused why I am getting this error because I followed the tutorial exactly and have also look at other resources that told me the same thing. Am I missing something? Could it be because my knot_project.py
file is not in the gym-knot
folder so it does not know that my environment exists? Any help would be appreciated.
This started happening to me after I upgraded gym from version 0.21 to 0.23, no solution yet but a good clue
[Update] It looks like it was a broken update
Download the zip file for 0.24.0 (or higher) for OpenAI from https://github.com/openai/gym/releases and manually install this version with pip install path/to/dir
See Re-added gym.make("MODULE:ENV") import style that was accidentally removed in v0.22 @arjun-kg
comment on patch notes
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.