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

how can I use metadrive environment? #54

Closed
hyoonsoo opened this issue Aug 8, 2022 · 3 comments
Closed

how can I use metadrive environment? #54

hyoonsoo opened this issue Aug 8, 2022 · 3 comments

Comments

@hyoonsoo
Copy link

hyoonsoo commented Aug 8, 2022

I want to use meta drive environment.
but It shows the same error: "No module named 'metadrive.envs'"
I'm using

gym 0.20.0
metadrive 1.4.9.1
metadrive-simulator 0.2.3 (as written in the document)

Can you give me some help? Thank you.

@Theohhhu
Copy link
Collaborator

Theohhhu commented Aug 9, 2022

Hi,

I recommend you reproduce this kind of error in your python console.

  1. switch to your python virtual environment
  2. type pip show metadrive to check the installation
  3. if you pass step 2, enter into the python console.
  4. in console, type import metadrive or import metadrive.envs to see the full error trace.

Any further question is welcome.

@Theohhhu
Copy link
Collaborator

You can reopen this issue if you have further questions.

@OscarBastardo
Copy link

I am having the same issue.

The full error trace as requested:

(marllib) oscar@dl:~/msc/MARLlib$ python marl/main.py --algo_config=mappo --env_config=metadrive with env_args.map_name=Roundabout
/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/scipy/__init__.py:143: UserWarning: A NumPy version >=1.19.5 and <1.27.0 is required for this version of SciPy (detected version 1.19.3)
  warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
It seems you don't install our cython utilities yet! Please reinstall MetaDrive via: <pip install -e .> or <pip install metadrive>! But don't worry! We are now falling back to native python implementation!
WARNING:root:It seems you don't install our cython utilities yet! Please reinstall MetaDrive via: <pip install -e .> or <pip install metadrive>! But don't worry! We are now falling back to native python implementation!
It seems you don't install our cython utilities yet! Please reinstall MetaDrive via: <pip install -e .> or <pip install metadrive>! But don't worry! We are now falling back to native python implementation!
WARNING:root:It seems you don't install our cython utilities yet! Please reinstall MetaDrive via: <pip install -e .> or <pip install metadrive>! But don't worry! We are now falling back to native python implementation!
Successfully registered the following environments: ['MetaDrive-test-v0', 'MetaDrive-validation-v0', 'MetaDrive-v0', 'MetaDrive-10envs-v0', 'MetaDrive-1000envs-v0', 'MetaDrive-training0-v0', 'MetaDrive-training1-v0', 'MetaDrive-training2-v0'].
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| Env_Name   | Check_Status   | Error_Log                           | Config_File_Location                | Env_File_Location          |
+============+================+=====================================+=====================================+============================+
| mpe        | Error          | No module named 'numpy.typing'      | envs/base_env/config/mpe.yaml       | envs/base_env/mpe.py       |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| mamujoco   | Error          | No module named 'multiagent_mujoco' | envs/base_env/config/mamujoco.yaml  | envs/base_env/mamujoco.py  |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| smac       | Error          | No module named 'smac'              | envs/base_env/config/smac.yaml      | envs/base_env/smac.py      |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| football   | Error          | No module named 'gfootball'         | envs/base_env/config/football.yaml  | envs/base_env/football.py  |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| magent     | Error          | No module named 'numpy.typing'      | envs/base_env/config/magent.yaml    | envs/base_env/magent.py    |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| rware      | Error          | No module named 'rware'             | envs/base_env/config/rware.yaml     | envs/base_env/rware.py     |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| lbf        | Error          | No module named 'lbforaging'        | envs/base_env/config/lbf.yaml       | envs/base_env/lbf.py       |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| pommerman  | Error          | No module named 'pommerman'         | envs/base_env/config/pommerman.yaml | envs/base_env/pommerman.py |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| hanabi     | Error          | No module named 'cffi'              | envs/base_env/config/hanabi.yaml    | envs/base_env/hanabi.py    |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
| metadrive  | Ready          | Null                                | envs/base_env/config/metadrive.yaml | envs/base_env/metadrive.py |
+------------+----------------+-------------------------------------+-------------------------------------+----------------------------+
use fc encoder
(pid=12551) /home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/scipy/__init__.py:143: UserWarning: A NumPy version >=1.19.5 and <1.27.0 is required for this version of SciPy (detected version 1.19.3)
(pid=12551)   warnings.warn(f"A NumPy version >={np_minversion} and <{np_maxversion}"
== Status ==
Current time: 2023-02-01 07:55:05 (running for 00:00:01.17)
Memory usage on this node: 2.6/31.3 GiB
Using FIFO scheduling algorithm.
Resources requested: 1.0/8 CPUs, 1.0/2 GPUs, 0.0/17.85 GiB heap, 0.0/8.92 GiB objects (0.0/1.0 accelerator_type:G)
Result logdir: /home/oscar/ray_results/mappo_gru_Roundabout
Number of trials: 1/1 (1 RUNNING)
+-----------------------------------------------+----------+-------+
| Trial name                                    | status   | loc   |
|-----------------------------------------------+----------+-------|
| MAPPOTrainer_metadrive_Roundabout_bcdde_00000 | RUNNING  |       |
+-----------------------------------------------+----------+-------+


2023-02-01 07:55:05,771 ERROR trial_runner.py:924 -- Trial MAPPOTrainer_metadrive_Roundabout_bcdde_00000: Error processing event.
Traceback (most recent call last):
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/tune/trial_runner.py", line 890, in _process_trial
    results = self.trial_executor.fetch_result(trial)
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/tune/ray_trial_executor.py", line 788, in fetch_result
    result = ray.get(trial_future[0], timeout=DEFAULT_GET_TIMEOUT)
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/_private/client_mode_hook.py", line 105, in wrapper
    return func(*args, **kwargs)
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/worker.py", line 1627, in get
    raise value
ray.exceptions.RayActorError: The actor died because of an error raised in its creation task, ray::MAPPOTrainer.__init__() (pid=12551, ip=192.168.0.98)
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/rllib/agents/trainer_template.py", line 137, in __init__
    Trainer.__init__(self, config, env, logger_creator)
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/rllib/agents/trainer.py", line 623, in __init__
    super().__init__(config, logger_creator)
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/tune/trainable.py", line 107, in __init__
    self.setup(copy.deepcopy(self.config))
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/rllib/agents/trainer_template.py", line 147, in setup
    super().setup(config)
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/rllib/agents/trainer.py", line 716, in setup
    self.env_creator = _global_registry.get(ENV_CREATOR, env)
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/tune/registry.py", line 168, in get
    return pickle.loads(value)
  File "/home/oscar/msc/MARLlib/envs/base_env/metadrive.py", line 3, in <module>
    from metadrive.envs.marl_envs import MultiAgentBottleneckEnv, MultiAgentParkingLotEnv, MultiAgentRoundaboutEnv, \
ModuleNotFoundError: No module named 'metadrive.envs'
== Status ==
Current time: 2023-02-01 07:55:05 (running for 00:00:01.17)
Memory usage on this node: 2.6/31.3 GiB
Using FIFO scheduling algorithm.
Resources requested: 0/8 CPUs, 0/2 GPUs, 0.0/17.85 GiB heap, 0.0/8.92 GiB objects (0.0/1.0 accelerator_type:G)
Result logdir: /home/oscar/ray_results/mappo_gru_Roundabout
Number of trials: 1/1 (1 ERROR)
+-----------------------------------------------+----------+-------+
| Trial name                                    | status   | loc   |
|-----------------------------------------------+----------+-------|
| MAPPOTrainer_metadrive_Roundabout_bcdde_00000 | ERROR    |       |
+-----------------------------------------------+----------+-------+
Number of errored trials: 1
+-----------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------------------------+
| Trial name                                    |   # failures | error file                                                                                                                 |
|-----------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------------------------|
| MAPPOTrainer_metadrive_Roundabout_bcdde_00000 |            1 | /home/oscar/ray_results/mappo_gru_Roundabout/MAPPOTrainer_metadrive_Roundabout_bcdde_00000_0_2023-02-01_07-55-04/error.txt |
+-----------------------------------------------+--------------+----------------------------------------------------------------------------------------------------------------------------+

(pid=12551) 2023-02-01 07:55:05,767     ERROR worker.py:425 -- Exception raised in creation task: The actor died because of an error raised in its creation task, ray::MAPPOTrainer.__init__() (pid=12551, ip=192.168.0.98)
(pid=12551)   File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/rllib/agents/trainer_template.py", line 137, in __init__
(pid=12551)     Trainer.__init__(self, config, env, logger_creator)
(pid=12551)   File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/rllib/agents/trainer.py", line 623, in __init__
(pid=12551)     super().__init__(config, logger_creator)
(pid=12551)   File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/tune/trainable.py", line 107, in __init__
(pid=12551)     self.setup(copy.deepcopy(self.config))
(pid=12551)   File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/rllib/agents/trainer_template.py", line 147, in setup
(pid=12551)     super().setup(config)
(pid=12551)   File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/rllib/agents/trainer.py", line 716, in setup
(pid=12551)     self.env_creator = _global_registry.get(ENV_CREATOR, env)
(pid=12551)   File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/tune/registry.py", line 168, in get
(pid=12551)     return pickle.loads(value)
(pid=12551)   File "/home/oscar/msc/MARLlib/envs/base_env/metadrive.py", line 3, in <module>
(pid=12551)     from metadrive.envs.marl_envs import MultiAgentBottleneckEnv, MultiAgentParkingLotEnv, MultiAgentRoundaboutEnv, \
(pid=12551) ModuleNotFoundError: No module named 'metadrive.envs'
Traceback (most recent call last):
  File "marl/main.py", line 55, in <module>
    run_cc(config_dict)
  File "/home/oscar/msc/MARLlib/marl/algos/run_cc.py", line 182, in run_cc
    results = POlICY_REGISTRY[config_dict["algorithm"]](config_dict, common_config, env_info_dict, stop)
  File "/home/oscar/msc/MARLlib/marl/algos/scripts/mappo.py", line 64, in run_mappo
    results = tune.run(MAPPOTrainer,
  File "/home/oscar/anaconda3/envs/marllib/lib/python3.8/site-packages/ray/tune/tune.py", line 624, in run
    raise TuneError("Trials did not complete", incomplete_trials)
ray.tune.error.TuneError: ('Trials did not complete', [MAPPOTrainer_metadrive_Roundabout_bcdde_00000])

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

3 participants