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

[Proposal] Implement gym.register_envs(minigrid) #455

Open
carlosgmartin opened this issue Nov 12, 2024 · 6 comments
Open

[Proposal] Implement gym.register_envs(minigrid) #455

carlosgmartin opened this issue Nov 12, 2024 · 6 comments

Comments

@carlosgmartin
Copy link

Currently, running the example on the front page of the MiniGrid documentation leads to the following error:

$ py -m pip install -U minigrid
Requirement already satisfied: minigrid in /Users/carlos/venv/lib/python3.12/site-packages (2.3.1)
$ py
>>> import gymnasium as gym
>>> gym.make("MiniGrid-Empty-5x5-v0")
gymnasium.error.NameNotFound: Environment `MiniGrid-Empty-5x5` doesn't exist.

On the other hand, other projects let you easily register all environments at once:

  • ALE lets you do import ale_py; gym.register_envs(ale_py).
  • Gymnasium-Robotics lets you do import gymnasium_robotics; gym.register_envs(gymnasium_robotics).
  • highway-env lets you do import highway_env; gym.register_envs(highway_env).

Is there an analogue for MiniGrid? If not, could you consider adding it?

@younik
Copy link
Member

younik commented Nov 12, 2024

gym.register_envs is a NOP of Gymnasium, so you can already do it with MiniGrid.
The reason why your code fails is that you are not importing minigrid before gym.make.

@pseudo-rnd-thoughts
Copy link
Member

pseudo-rnd-thoughts commented Nov 12, 2024

I think the problem is that Minigrid doesn't register the environments on import.

#453 will fix this for gymnasium v1.0

@carlosgmartin
Copy link
Author

@younik

The reason why your code fails is that you are not importing minigrid before gym.make.

>>> import gymnasium as gym
>>> import minigrid
>>> gym.make("MiniGrid-Empty-5x5-v0")
gymnasium.error.NameNotFound: Environment `MiniGrid-Empty-5x5` doesn't exist.

@younik
Copy link
Member

younik commented Nov 12, 2024

@younik

The reason why your code fails is that you are not importing minigrid before gym.make.

>>> import gymnasium as gym
>>> import minigrid
>>> gym.make("MiniGrid-Empty-5x5-v0")
gymnasium.error.NameNotFound: Environment `MiniGrid-Empty-5x5` doesn't exist.

Oh, you are right, apologize for the confusion, this works only with gymnasium<1.0.0

@ValkyrieMashiro
Copy link

ValkyrieMashiro commented Nov 14, 2024

same problem, and I solve it by install gymnasium==0.29.0. When u use 'pip install minigrid', it will get gymnasium==1.0.0 for u automatically.

@ValkyrieMashiro
Copy link

ValkyrieMashiro commented Nov 14, 2024

@younik

The reason why your code fails is that you are not importing minigrid before gym.make.

>>> import gymnasium as gym
>>> import minigrid
>>> gym.make("MiniGrid-Empty-5x5-v0")
gymnasium.error.NameNotFound: Environment `MiniGrid-Empty-5x5` doesn't exist.

Oh, you are right, apologize for the confusion, this works only with gymnasium<1.0.0

true dude, but the thing is when I 'pip install minigrid' as the instruction in the document, it will install gymnasium==1.0.0 automatically for me, which will not work. That's quite confusing. I hope there might be some updates on the document.

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

4 participants