Closed jlsvane closed 12 months ago
Hey, thanks for raising the issue.
I think the issue is that the tutorial still uses gym and should be using gymnasium. If you replace import gym
with import gymnasium as gym
does this fix the issues ?
Hi Mark,
Thanks - it works. Two files need correction: in the gridworld file itself as well as in the the init file where the registration takes place.
BR
Jorgen
We have updated the environment creation tutorial so this should no longer be an issue
The error still occurs and cannot be fixed via pull request because: https://github.com/Farama-Foundation/gym-examples is no longer maintained and archived.
However, https://github.com/Farama-Foundation/gym-examples is used in the current documentation here: https://gymnasium.farama.org/tutorials/gymnasium_basics/environment_creation
As Jorgen @jlsvane mentioned, two files would have to be fixed:
gym_examples/__init__.py
#from gym.envs.registration import register
from gymnasium.envs.registration import register
gym_examples/envs/grid_world.py
#import gym
#from gym import spaces
import gymnasium as gym
from gymnasium import spaces
As a newcomer, trying to understand how to use the gymnasium library by going through the official documentation examples, it makes things hard when things break by design.
So please, someone who can fix this in the archived repo, please fix it. Thank you, Elmar
For the updated tutorials see https://gymnasium.farama.org/main/introduction/create_custom_env/ and a larger version - https://gymnasium.farama.org/main/tutorials/gymnasium_basics/environment_creation/
ah, I see. I am sorry. thank you, @pseudo-rnd-thoughts for the link to the recent version! this is very helpful.
Describe the bug
Hi
Conda environment: see attached yml file as txt
I'm trying to run the custom environment example from url by cloning the git and then following the instructions and installing by "pip install -e ." It fails unless I change the setup file from install_requires=["gym==0.26.0", "pygame==2.1.0"] to this install_requires=["gym>=0.26.0", "pygame>=2.1.0"] when it installs pygame==2.1.0.
When changing this it appears to install. However, when running:
import gymnasium
import gym_examples
env = gymnasium.make('gym_examples/GridWorld-v0')
it fails with this error:
Traceback (most recent call last): File "/home/novelty/gym-examples/grid_test.py", line 10, in
env = gymnasium.make('gym_examples/GridWorld-v0')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/novelty/miniconda3/envs/gymnas_test/lib/python3.11/site-packages/gymnasium/envs/registration.py", line 592, in make
_check_version_exists(ns, name, version)
File "/home/novelty/miniconda3/envs/gymnas_test/lib/python3.11/site-packages/gymnasium/envs/registration.py", line 218, in _check_version_exists
_check_name_exists(ns, name)
File "/home/novelty/miniconda3/envs/gymnas_test/lib/python3.11/site-packages/gymnasium/envs/registration.py", line 185, in _check_name_exists
_check_namespace_exists(ns)
File "/home/novelty/miniconda3/envs/gymnas_test/lib/python3.11/site-packages/gymnasium/envs/registration.py", line 180, in _check_namespace_exists
raise error.NamespaceNotFound(f"Namespace {ns} not found. {suggestion_msg}")
gymnasium.error.NamespaceNotFound: Namespace gym_examples not found. Have you installed the proper package for gym_examples?
environment.txt
Code example
System info
Gymnasium installed using pip
Additional context
No response
Checklist