flow-project/flow

Tutorial 8 can't be run when "render=False" with Rllib

NovemberChopin opened this issue · 3 comments

Bug Description

Tutorial 8 in "2.2 Training the New Environment" by Rllib section.

It works when render=True is running, but it will report an error when render is set to False.

Bug Reproduce.

I don't know why there is a mistake: traci.exceptions.TraCIException: The vehicle 'human_0' to add already exists.

  • system: Ubuntu 20.04
  • environment: Miniconda: python 3.7.3
  • sumo: 1.4.0
  • flow: master branch: 0.5
  • ray: 0.8.0
    File in which the bug occurred: flow/tutorials/tutorial08_environments.ipynb

At first, I think maybe the reason is my sumo(I install sumo by sudo install sumo rather than run the install script in flow), so I use the script scripts/setup_sumo_ubuntu1804.sh to install Sumo. But it's still the same mistake.

Is there anyone with the same problem?
Please help me and thank you so much

(pid=13306) 2021-08-29 13:34:23,662     INFO trainer.py:371 -- Tip: set 'eager': true or the --eager flag to enable TensorFlow eager execution
(pid=13306) 2021-08-29 13:34:23,837     INFO trainer.py:512 -- Current log_level is WARN. For more information, set 'log_level': 'INFO' / 'DEBUG' or use the -v and -vv flags.
(pid=13306) 2021-08-29 13:34:28,249     WARNING util.py:45 -- Install gputil for GPU system monitoring.
2021-08-29 13:34:42,519 ERROR trial_runner.py:482 -- Error processing event.
Traceback (most recent call last):
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/tune/trial_runner.py", line 426, in _process_trial
    result = self.trial_executor.fetch_result(trial)
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/tune/ray_trial_executor.py", line 378, in fetch_result
    result = ray.get(trial_future[0], DEFAULT_GET_TIMEOUT)
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/worker.py", line 1457, in get
    raise value.as_instanceof_cause()
ray.exceptions.RayTaskError(TraCIException): ray::PPO.train() (pid=13306, ip=10.193.254.45)
  File "python/ray/_raylet.pyx", line 636, in ray._raylet.execute_task
  File "python/ray/_raylet.pyx", line 619, in ray._raylet.execute_task.function_executor
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/agents/trainer.py", line 444, in train
    raise e
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/agents/trainer.py", line 433, in train
    result = Trainable.train(self)
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/tune/trainable.py", line 176, in train
    result = self._train()
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/agents/trainer_template.py", line 129, in _train
    fetches = self.optimizer.step()
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/optimizers/multi_gpu_optimizer.py", line 140, in step
    self.num_envs_per_worker, self.train_batch_size)
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/optimizers/rollout.py", line 29, in collect_samples
    next_sample = ray_get_and_free(fut_sample)
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/utils/memory.py", line 33, in ray_get_and_free
    result = ray.get(object_ids)
ray.exceptions.RayTaskError(TraCIException): ray::RolloutWorker.sample() (pid=13305, ip=10.193.254.45)
  File "/home/jinshi/workplace/paper-env/flow/flow/core/kernel/vehicle/traci.py", line 1120, in add
    departSpeed=str(speed))
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/traci/_vehicle.py", line 1427, in add
    self._connection._sendExact()
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/traci/connection.py", line 106, in _sendExact
    raise TraCIException(err, prefix[1], _RESULTS[prefix[2]])
traci.exceptions.TraCIException: The vehicle 'human_0' to add already exists.

During handling of the above exception, another exception occurred:

ray::RolloutWorker.sample() (pid=13305, ip=10.193.254.45)
  File "python/ray/_raylet.pyx", line 633, in ray._raylet.execute_task
  File "python/ray/_raylet.pyx", line 634, in ray._raylet.execute_task
  File "python/ray/_raylet.pyx", line 636, in ray._raylet.execute_task
  File "python/ray/_raylet.pyx", line 619, in ray._raylet.execute_task.function_executor
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/evaluation/rollout_worker.py", line 471, in sample
    batches = [self.input_reader.next()]
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/evaluation/sampler.py", line 56, in next
    batches = [self.get_data()]
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/evaluation/sampler.py", line 99, in get_data
    item = next(self.rollout_provider)
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/evaluation/sampler.py", line 319, in _env_runner
    soft_horizon, no_done_at_end)
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/evaluation/sampler.py", line 480, in _process_observations
    resetted_obs = base_env.try_reset(env_id)
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/env/base_env.py", line 336, in try_reset
    return {_DUMMY_AGENT_ID: self.vector_env.reset_at(env_id)}
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/ray/rllib/env/vector_env.py", line 104, in reset_at
    return self.envs[index].reset()
  File "/home/jinshi/workplace/paper-env/flow/flow/envs/ring/accel.py", line 177, in reset
    obs = super().reset()
  File "/home/jinshi/workplace/paper-env/flow/flow/envs/base.py", line 519, in reset
    speed=speed)
  File "/home/jinshi/workplace/paper-env/flow/flow/core/kernel/vehicle/traci.py", line 1120, in add
    departSpeed=str(speed))
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/traci/_vehicle.py", line 1427, in add
    self._connection._sendExact()
  File "/home/jinshi/miniconda3/envs/flow/lib/python3.7/site-packages/traci/connection.py", line 106, in _sendExact
    raise TraCIException(err, prefix[1], _RESULTS[prefix[2]])
traci.exceptions.TraCIException: The vehicle 'human_0' to add already exists.

I also got this error and I see no one currently supports the use of this tool. This team hasn't commented for almost a year now

I also got this error and I see no one currently supports the use of this tool. This team hasn't commented for almost a year now

yes. so I give up this project

I also got this error and I see no one currently supports the use of this tool. This team hasn't commented for almost a year now

yes. so I give up this project

I also got this error and I see no one currently supports the use of this tool. This team hasn't commented for almost a year now

yes. so I give up this project

I find this tool very nice but unfortunately, no one supports it. I want to combine Sumo with a tool that uses DRL but I can't find any right now