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

[Bug]: Custom environment not found in gym registry, you maybe meant... error message #443

Open
5 tasks done
jiceline03 opened this issue Apr 11, 2024 · 1 comment
Open
5 tasks done
Labels
custom gym env Issue related to Custom Gym Env

Comments

@jiceline03
Copy link

🐛 Bug

I am encountering an issue when trying to train my donkeycar simulator agent using the train.py script from rl-baselines3-zoo. While I can successfully import and call the environment using gym.make('donkey-mountain-track-v0') in an IPython session (confirming the environment's availability), attempting to use the same environment within rl-baselines3-zoo results in an error indicating that the environment is not found in the gym registry.

This situation is puzzling for several reasons, given that I have taken the following steps to ensure compatibility and correct setup:

  1. Confirmed gym_donkeycar Import: I verified that gym_donkeycar is imported correctly in import_envs.py within the rl-baselines3-zoo framework. This should theoretically ensure that rl-baselines3-zoo recognizes the custom environment.
  2. Updated Hyperparameters File: I updated the hyperparameters file within rl-baselines3-zoo to reflect the correct environment name, donkey-mountain-track-v0. This ensures that the training script should look for the correct environment ID when initializing the training process.
  3. I also followed [https://www.youtube.com/watch?v=ngK33h00iBE&t=2038s] this tutorial step by step and reproduced everything identically.

Despite these measures, the issue persists. Further debugging showed that although train.py successfully imports gym_donkeycar, but when I print out the list of environments currently registered in the gym registry immediately before the error occurs, the donkeycar environments are not listed.

I am looking for insights into why the environment registration for donkey-mountain-track-v0 might not be persisting or being recognized in the context of rl-baselines3-zoo's train.py execution, despite seemingly successful import and registration steps. Your help would be invaluable.

To Reproduce

  1. Install gym-donkeycar and configure as per documentation.
  2. Install rlzoo3, ensure gym_donkeycar custom env is imported in through import_envs.py, change the tqc3 hyperparam file to reflect the correct environment (with the environment set to donkey-mountain-track-v0).
  3. Run train.py
  4. Encounter the registry error.

Relevant log output / Error message

Traceback (most recent call last):
  File "/mnt/c/rl/donkey/rl-baselines3-zoo/train.py", line 4, in <module>
    train()
  File "/mnt/c/rl/donkey/rl-baselines3-zoo/rl_zoo3/train.py", line 176, in train
    raise ValueError(f"{env_id} not found in gym registry, you maybe meant {closest_match}?")
ValueError: donkey-mountain-track-v0 not found in gym registry, you maybe meant DemonAttack-v0?

System Info

  • Python: 3.9.16
  • Stable-Baselines3: 2.3.0
  • PyTorch: 2.2.2
  • GPU Enabled: False
  • Numpy: 1.26.4
  • Cloudpickle: 3.0.0
  • Gymnasium: 0.29.1
  • OpenAI Gym: 0.22.0

Checklist

@jiceline03 jiceline03 added the bug Something isn't working label Apr 11, 2024
@araffin
Copy link
Member

araffin commented Apr 11, 2024

gym is no longer supported since #403

so i would recommend you to update the env to gymnasium and do a pull request to the gym donkey car repo so it would benefit everyone.

Another alternative is to use an old version of everything but this will bring you only more trouble.

@araffin araffin added custom gym env Issue related to Custom Gym Env and removed bug Something isn't working labels Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
custom gym env Issue related to Custom Gym Env
Projects
None yet
Development

No branches or pull requests

2 participants