araffin / learning-to-drive-in-5-minutes

Implementation of reinforcement learning approach to make a car learn to drive smoothly in minutes
https://towardsdatascience.com/learning-to-drive-smoothly-in-minutes-450a7cdb35f4
MIT License
284 stars 88 forks source link

Missing DONKEY_SIM_PATH environment var #1

Closed maxencebrochard closed 5 years ago

maxencebrochard commented 5 years ago

Hi,

I am trying to run the train.py file with the followig command: python train.py --algo sac -vae pretrained_vae/vae-level-0-dim-32.pkl -n 5000

I get the following logs:

pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
========== DonkeyVae-v0-level-0 sac ==========
Loading VAE ...
2019-02-04 18:18:13.323197: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Dim VAE = 32
OrderedDict([('batch_size', 64),
             ('buffer_size', 30000),
             ('ent_coef', 'auto_0.1'),
             ('gamma', 0.99),
             ('gradient_steps', 600),
             ('learning_rate', 0.0003),
             ('learning_starts', 300),
             ('n_timesteps', 5000.0),
             ('policy', 'CustomSACPolicy'),
             ('train_freq', 3000),
             ('vae_path', 'pretrained_vae/vae-level-0-dim-32.pkl'),
             ('z_size', 32),
             ('MIN_THROTTLE', 0.4),
             ('MAX_THROTTLE', 0.6),
             ('FRAME_SKIP', 1),
             ('MAX_CTE_ERROR', 2.0),
             ('N_COMMAND_HISTORY', 20),
             ('MAX_STEERING_DIFF', 0.15)])
Starting DonkeyGym env
Missing DONKEY_SIM_PATH environment var. We assume the unity env is already started
Binding to ('0.0.0.0', 9091)
Waiting for sim to start...if the simulation is running, press EXIT to go back to the menu

It keeps printing the last line over and over.

So, I tried to create an environment variable called DONKEY_SIMPATH pointing with the following path \learning-to-drive-in-5-minutes\donkeygym

I get the following error while running the script:

pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
========== DonkeyVae-v0-level-0 sac ==========
Loading VAE ...
2019-02-04 18:18:13.323197: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Dim VAE = 32
OrderedDict([('batch_size', 64),
             ('buffer_size', 30000),
             ('ent_coef', 'auto_0.1'),
             ('gamma', 0.99),
             ('gradient_steps', 600),
             ('learning_rate', 0.0003),
             ('learning_starts', 300),
             ('n_timesteps', 5000.0),
             ('policy', 'CustomSACPolicy'),
             ('train_freq', 3000),
             ('vae_path', 'pretrained_vae/vae-level-0-dim-32.pkl'),
             ('z_size', 32),
             ('MIN_THROTTLE', 0.4),
             ('MAX_THROTTLE', 0.6),
             ('FRAME_SKIP', 1),
             ('MAX_CTE_ERROR', 2.0),
             ('N_COMMAND_HISTORY', 20),
             ('MAX_STEERING_DIFF', 0.15)])
Starting DonkeyGym env
Traceback (most recent call last):
  File "train.py", line 118, in <module>
    env = DummyVecEnv([make_env(args.seed, vae=vae, teleop=args.teleop)])
  File "C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\stable_baselines\common\vec_env\dummy_vec_env.py", line 17, in __init__
    self.envs = [fn() for fn in env_fns]
  File "C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\stable_baselines\common\vec_env\dummy_vec_env.py", line 17, in <listcomp>
    self.envs = [fn() for fn in env_fns]
  File "C:\Users\...\learning-to-drive-in-5-minutes\learning-to-drive-in-5-minutes\utils\utils.py", line 121, in _init
    n_stack=n_stack)
  File "C:\Users\...\learning-to-drive-in-5-minutes\learning-to-drive-in-5-minutes\donkey_gym\envs\vae_env.py", line 74, in __init__
    self.unity_process.start(exe_path, headless=headless, port=port)
  File "C:\Users\...\learning-to-drive-in-5-minutes\learning-to-drive-in-5-minutes\donkey_gym\core\donkey_proc.py", line 32, in start
    [sim_path] + port_args)
  File "C:\ProgramData\Anaconda3\envs\tensorflow\lib\subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "C:\ProgramData\Anaconda3\envs\tensorflow\lib\subprocess.py", line 957, in _execute_child
    startupinfo)
PermissionError: [WinError 5]

The script is run on Windows. Would have any idea how to solve this issue?

Many thanks for your help

araffin commented 5 years ago

Hello, Did you download and start the simulator?

If you don't start it manually, DONKEY_SIM_PATH must point to the simulator executable, not the donkey_gym folder.