wuxiyang1996 / iPLAN

iPLAN: Intent-Aware Planning in Heterogeneous Traffic via Distributed Multi-Agent Reinforcement Learning
https://arxiv.org/abs/2306.06236
MIT License
32 stars 3 forks source link

Version of highway-env package #1

Closed redfish9 closed 4 months ago

redfish9 commented 4 months ago

Hi @rohanchandra30 @wuxiyang1996 ! Thanks for your awesome work!

I'm recently working on a project using the iPLAN framework. I can successfully run experiments based on MPE environment and I make sure the Heterogeneous_Highway_Env package is installed. However, I encontered an error when running HighwayEnv-based experiments as below.

Traceback (most recent call last):
  File "C:\WorkSpace\Software\miniconda\envs\ipgym\lib\multiprocessing\process.py", line 315, in _bootstrap
    self.run()
  File "C:\WorkSpace\Software\miniconda\envs\ipgym\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "C:\WorkSpace\Ming\ipgym\envs\env_wrappers.py", line 141, in worker
    env = env_fn_wrapper.x()
  File "C:\WorkSpace\Ming\ipgym\run_ippo.py", line 412, in init_env
    env = env_wrapper(all_args)
  File "C:\WorkSpace\Ming\ipgym\run_ippo.py", line 439, in env_wrapper
    env = gym.make("higway-hetero-v0")
  File "C:\WorkSpace\Software\miniconda\envs\ipgym\lib\site-packages\gym\envs\registration.py", line 569, in make
    _check_version_exists(ns, name, version)
  File "C:\WorkSpace\Software\miniconda\envs\ipgym\lib\site-packages\gym\envs\registration.py", line 219, in _check_version_exists
    _check_name_exists(ns, name)
  File "C:\WorkSpace\Software\miniconda\envs\ipgym\lib\site-packages\gym\envs\registration.py", line 197, in _check_name_exists
    raise error.NameNotFound(
gym.error.NameNotFound: Environment highway-hetero doesn't exist.

Hence, I tried to register this environment using the following scripts.

import gym
from gym.envs.registration import register

register(id='highway-hetero-v0', entry_point='highway_env.envs:HighwayEnvHetero')
gym.make('highway-hetero-v0') 

Then an error relevant to the absence of module named 'highway_env' occurred.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\WorkSpace\Software\miniconda\envs\ipgym\lib\site-packages\gym\envs\registration.py", line 581, in make
    env_creator = load(spec_.entry_point)
  File "C:\WorkSpace\Software\miniconda\envs\ipgym\lib\site-packages\gym\envs\registration.py", line 61, in load
    mod = importlib.import_module(mod_name)
  File "C:\WorkSpace\Software\miniconda\envs\ipgym\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'highway_env'

As highway-env has moved from gym to gymnasium, the dependency in Heterogeneous_Highway_Env is different from the latest version of highway-env. So I'm wondering if I can solve this by simply insatll a version of highway-env compatible to your framework(like v1.7 which still uses gym). I would also be grateful if you can offer me the version you are using as I cannot find a suggested one in "requirements.txt" nor in the readme file. Or, would you recommend that I install the latest highway-env package and then overwrite the original files with the files from the Heterogeneous_Highway_Env package?

Looking forward to your reply! Thanks again!

wuxiyang1996 commented 4 months ago

Hi @redfish9,

I recommend you install a highway-env (I am using v1.6) package first and then replace the code inside this package with the code in Heterogeneous_Highway_Env.

Will figure out the transplantation into the gymnasium in the next few days.

Thank you!

redfish9 commented 4 months ago

Thanks for your prompt reply! I'll try your recommended approach. Looking forward to see your following works!

hankerbit commented 4 months ago

Hi @redfish9,

I recommend you install a highway-env (I am using v1.6) package first and then replace the code inside this package with the code in Heterogeneous_Highway_Env.

Will figure out the transplantation into the gymnasium in the next few days.

Thank you!

Hi, i have the same issue, but i can not follow your reply. Could you show a more clear solution? Thanks very much.

wuxiyang1996 commented 4 months ago

Hi @hankerbit,

Try to install highway-env v1.6 from here first https://github.com/Farama-Foundation/HighwayEnv

Then use the code in the Heterogeneous_Highway_Env repo to cover the initial highway-env.

hankerbit commented 4 months ago

Hi @hankerbit,

Try to install highway-env v1.6 from here first https://github.com/Farama-Foundation/HighwayEnv

Then use the code in the Heterogeneous_Highway_Env repo to cover the initial highway-env.

Thanks, but how i can cover the highway-env v1.6? copy or reinstall Heterogeneous_Highway_Env?

wuxiyang1996 commented 4 months ago

Use pip to install, find the package in Anaconda's installation path, and cover the installed highway env with the Heterogeneous_Highway_Env repo

hankerbit commented 4 months ago

Use pip to install, find the package in Anaconda's installation path, and cover the installed highway env with the Heterogeneous_Highway_Env repo

Thanks very much.

hankerbit commented 4 months ago

Use pip to install, find the package in Anaconda's installation path, and cover the installed highway env with the Heterogeneous_Highway_Env repo

Hi, I try to copy the content in Heterogeneous_Highway_Env repo INTO highway env v1.6. But there is also the same error :"gym.error.NameNotFound: Environment highway-hetero doesn't exist. "

wuxiyang1996 commented 4 months ago

Check here: https://github.com/wuxiyang1996/Heterogeneous_Highway_Env/blob/b96a34754f608bf3e2e9832a35c828bf11782794/envs/highway_env.py#L884

Please ensure that you are using the correct environment name.