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

minigrid not imported in env.py #12

Open
robotasun opened this issue Dec 3, 2024 · 0 comments
Open

minigrid not imported in env.py #12

robotasun opened this issue Dec 3, 2024 · 0 comments

Comments

@robotasun
Copy link

The environment generator utility for the training (train.py), evaluation (evaluate.py), and visualizer (visualize.py) does not import minigrid, leading to an error.

Traceback:

python3 -m scripts.train --algo ppo --env MiniGrid-DoorKey-8x8-v0 --model DoorKey --save-interval 10 --frames 80000
/home/kobot/rl_gym/rl-starter-files/scripts/train.py --algo ppo --env MiniGrid-DoorKey-8x8-v0 --model DoorKey --save-interval 10 --frames 80000

Namespace(algo='ppo', env='MiniGrid-DoorKey-8x8-v0', model='DoorKey', seed=1, log_interval=1, save_interval=10, procs=16, frames=80000, epochs=4, batch_size=256, frames_per_proc=None, discount=0.99, lr=0.001, gae_lambda=0.95, entropy_coef=0.01, value_loss_coef=0.5, max_grad_norm=0.5, optim_eps=1e-08, optim_alpha=0.99, clip_eps=0.2, recurrence=1, text=False, mem=False)

Device: cuda

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/kobot/rl_gym/rl-starter-files/scripts/train.py", line 101, in <module>
    envs.append(utils.make_env(args.env, args.seed + 10000 * i))
  File "/home/kobot/rl_gym/rl-starter-files/utils/env.py", line 5, in make_env
    env = gym.make(env_key, render_mode=render_mode)
  File "/home/kobot/.local/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 687, in make
    env_spec = _find_spec(id)
  File "/home/kobot/.local/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 531, in _find_spec
    _check_version_exists(ns, name, version)
  File "/home/kobot/.local/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 397, in _check_version_exists
    _check_name_exists(ns, name)
  File "/home/kobot/.local/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 374, in _check_name_exists
    raise error.NameNotFound(
gymnasium.error.NameNotFound: Environment `MiniGrid-DoorKey-8x8` doesn't exist.

Isolated example:

>>> import gymnasium as gym
>>> def make_env(env_key, seed=None, render_mode=None):
...     env = gym.make(env_key, render_mode=render_mode)
...     env.reset(seed=seed)
...     return env
... 
>>> env = gym.make("MiniGrid-Empty-8x8-v0",render_mode=None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kobot/.local/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 687, in make
    env_spec = _find_spec(id)
  File "/home/kobot/.local/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 531, in _find_spec
    _check_version_exists(ns, name, version)
  File "/home/kobot/.local/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 397, in _check_version_exists
    _check_name_exists(ns, name)
  File "/home/kobot/.local/lib/python3.10/site-packages/gymnasium/envs/registration.py", line 374, in _check_name_exists
    raise error.NameNotFound(
gymnasium.error.NameNotFound: Environment `MiniGrid-Empty-8x8` doesn't exist.
>>> "MiniGrid-Empty-8x8-v0" in gym.envs.registry.keys()
False
>>> import minigrid
>>> "MiniGrid-Empty-8x8-v0" in gym.envs.registry.keys()
True
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

1 participant