eleurent / rl-agents

Implementations of Reinforcement Learning and Planning algorithms
MIT License
582 stars 152 forks source link

gym.error.NameNotFound: Environment intersection doesn't exist. #95

Open Lucyliu09 opened 1 year ago

Lucyliu09 commented 1 year ago

Hi,thanks for your work first!

But when I'm trying to run 'python experiments.py evaluate configs/IntersectionEnv/env.json \ configs/IntersectionEnv/agents/DQNAgent/ego_attention_2h.json \ --train --episodes=4000 --name-from-config'

Something wrong happend:

import_module highway_env Traceback (most recent call last): File "/.local/lib/python3.9/site-packages/rl_agents/agents/common/factory.py", line 76, in load_environment env = gym.make(env_config['id'],render_mode='rgb_array') File "/.local/lib/python3.9/site-packages/gym/envs/registration.py", line 569, in make _check_version_exists(ns, name, version) File "/.local/lib/python3.9/site-packages/gym/envs/registration.py", line 219, in _check_version_exists _check_name_exists(ns, name) File "/.local/lib/python3.9/site-packages/gym/envs/registration.py", line 197, in _check_name_exists raise error.NameNotFound( gym.error.NameNotFound: Environment intersection doesn't exist. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/rl-agents-master/rl-agents-master/scripts/experiments.py", line 150, in main() File "/rl-agents-master/rl-agents-master/scripts/experiments.py", line 45, in main evaluate(opts[''], opts[''], opts) File "/rl-agents-master/rl-agents-master/scripts/experiments.py", line 61, in evaluate env = load_environment(environment_config) File "/.local/lib/python3.9/site-packages/rl_agents/agents/common/factory.py", line 85, in load_environment raise gym.error.UnregisteredEnv('Environment {} not registered. The environment module should be specified by ' gym.error.UnregisteredEnv: Environment intersection-v0 not registered. The environment module should be specified by the "import_module" key of the environment configuration

I've aleardy installed all the packages required,and I tried to find a solution online, but it didn't work. Hope to receive your replay!

Lucyliu09 commented 1 year ago

Well,I've found your earlier replay about the similiar issue.https://github.com/eleurent/highway-env/issues/431

Still thanks a lot!

But there's something wrong about visualization(The screen of videos saved are black.) And I couldn't find out the cause of the problem.

Hope to receive your replay!

eleurent commented 1 year ago

That is strange, I am unable to reproduce this issue of the videos being black. You can for example run this colab, which produces a correct video.

siatjia commented 1 year ago

i have the same error, and how to register the IntersectionEnv?

l solve it, in experiment.py, add the following,

import highway_env highway_env.register_highway_envs()

enjoy it