oxwhirl / pymarl

Python Multi-Agent Reinforcement Learning framework
Apache License 2.0
1.88k stars 386 forks source link

WinError when running the Readme experiment #77

Open nfitch3 opened 4 years ago

nfitch3 commented 4 years ago

Hi, I'm hoping you can help me debug what seems like a simple error. I'm on a Windows machine and I tried running the example experiment:

python src/main.py --config=qmix --env-config=sc2 with env_args.map_name=2s3z

At first I was running as-is but it was taking awhile to run, so I adjusted the config (or args) t_max variable and adjusted it down to 10,000 (default was 2,050,000). I get the error OSError: [WinError 1] Incorrect function traced back to line 51 in run.py on the print('Exiting Main') function. Here's the complete terminal print out:

`(does_tf2) C:\Users\nfitch3\Documents\Projects\DOES\PyMARL>python src/main.py --config=qmix --env-config=sc2 with env_args.map_name=2s3z [DEBUG 10:50:31] git.util Failed checking if running in CYGWIN due to: FileNotFoundError(2, 'The system cannot find the file specified', None, 2, None) [DEBUG 10:50:31] git.cmd Popen(['git', 'diff', '--cached', '--abbrev=40', '--full-index', '--raw'], cwd=C:\Users\nfitch3\Documents\Projects\DOES\PyMARL, universal_newlines=False, shell=None, istream=None) [DEBUG 10:50:31] git.cmd Popen(['git', 'diff', '--abbrev=40', '--full-index', '--raw'], cwd=C:\Users\nfitch3\Documents\Projects\DOES\PyMARL, universal_newlines=False, shell=None, istream=None) [DEBUG 10:50:31] git.cmd Popen(['git', 'cat-file', '--batch-check'], cwd=C:\Users\nfitch3\Documents\Projects\DOES\PyMARL, universal_newlines=False, shell=None, istream=) [DEBUG 10:50:31] git.cmd Popen(['git', 'diff', '--cached', '--abbrev=40', '--full-index', '--raw'], cwd=C:\Users\nfitch3\Documents\Projects\DOES\PyMARL, universal_newlines=False, shell=None, istream=None) [DEBUG 10:50:31] git.cmd Popen(['git', 'diff', '--abbrev=40', '--full-index', '--raw'], cwd=C:\Users\nfitch3\Documents\Projects\DOES\PyMARL, universal_newlines=False, shell=None, istream=None) [DEBUG 10:50:31] git.cmd Popen(['git', 'cat-file', '--batch-check'], cwd=C:\Users\nfitch3\Documents\Projects\DOES\PyMARL, universal_newlines=False, shell=None, istream=) [DEBUG 10:50:32] git.cmd Popen(['git', 'diff', '--cached', '--abbrev=40', '--full-index', '--raw'], cwd=C:\Users\nfitch3\Documents\Projects\DOES\PyMARL, universal_newlines=False, shell=None, istream=None) [DEBUG 10:50:32] git.cmd Popen(['git', 'diff', '--abbrev=40', '--full-index', '--raw'], cwd=C:\Users\nfitch3\Documents\Projects\DOES\PyMARL, universal_newlines=False, shell=None, istream=None) [DEBUG 10:50:32] git.cmd Popen(['git', 'cat-file', '--batch-check'], cwd=C:\Users\nfitch3\Documents\Projects\DOES\PyMARL, universal_newlines=False, shell=None, istream=) src/main.py:80: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config_dict = yaml.load(f) src/main.py:50: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. config_dict = yaml.load(f) src/main.py:58: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working if isinstance(v, collections.Mapping): [INFO 10:50:32] root Saving to FileStorageObserver in results/sacred. [DEBUG 10:50:34] pymarl Using capture mode "fd" [INFO 10:50:34] pymarl Running command 'my_main' --- Logging error --- [INFO 10:50:34] pymarl Started run with ID "11" --- Logging error --- [DEBUG 10:50:34] pymarl Starting Heartbeat --- Logging error --- [DEBUG 10:50:34] my_main Started --- Logging error --- [WARNING 10:50:34] my_main CUDA flag use_cuda was switched OFF automatically because no CUDA devices are available! --- Logging error --- [INFO 10:50:34] my_main Experiment Parameters: --- Logging error --- [INFO 10:50:34] my_main

{ 'action_selector': 'epsilon_greedy', 'agent': 'rnn', 'agent_output_type': 'q', 'batch_size': 32, 'batch_size_run': 1, 'buffer_cpu_only': True, 'buffer_size': 5000, 'checkpoint_path': '', 'critic_lr': 0.0005, 'double_q': True, 'env': 'sc2', 'env_args': { 'continuing_episode': False, 'debug': False, 'difficulty': '7', 'game_version': None, 'heuristic_ai': False, 'heuristic_rest': False, 'map_name': '2s3z', 'move_amount': 2, 'obs_all_health': True, 'obs_instead_of_state': False, 'obs_last_action': False, 'obs_own_health': True, 'obs_pathing_grid': False, 'obs_terrain_height': False, 'obs_timestep_number': False, 'replay_dir': '', 'replay_prefix': '', 'reward_death_value': 10, 'reward_defeat': 0, 'reward_negative_scale': 0.5, 'reward_only_positive': True, 'reward_scale': True, 'reward_scale_rate': 20, 'reward_sparse': False, 'reward_win': 200, 'seed': 226539538, 'state_last_action': True, 'state_timestep_number': False, 'step_mul': 8}, 'epsilon_anneal_time': 50000, 'epsilon_finish': 0.05, 'epsilon_start': 1.0, 'evaluate': False, 'gamma': 0.99, 'grad_norm_clip': 10, 'hypernet_embed': 64, 'hypernet_layers': 2, 'label': 'default_label', 'learner': 'q_learner', 'learner_log_interval': 10000, 'load_step': 0, 'local_results_path': 'results', 'log_interval': 10000, 'lr': 0.0005, 'mac': 'basic_mac', 'mixer': 'qmix', 'mixing_embed_dim': 32, 'name': 'qmix', 'obs_agent_id': True, 'obs_last_action': True, 'optim_alpha': 0.99, 'optim_eps': 1e-05, 'repeat_id': 1, 'rnn_hidden_dim': 64, 'runner': 'episode', 'runner_log_interval': 10000, 'save_model': False, 'save_model_interval': 2000000, 'save_replay': False, 'seed': 226539538, 't_max': 10000, 'target_update_interval': 200, 'test_greedy': True, 'test_interval': 10000, 'test_nepisode': 32, 'use_cuda': False, 'use_tensorboard': False}

--- Logging error --- [INFO 10:50:34] my_main Beginning training for 10000 timesteps --- Logging error --- [INFO 10:50:34] absl Launching SC2: C:\Program Files (x86)\StarCraft II\Versions/Base80188\SC2_x64.exe -listen 127.0.0.1 -port 24603 -dataDir C:\Program Files (x86)\StarCraft II\ -tempDir C:\Users\nfitch3\AppData\Local\Temp\sc-6_nsl2lk\ -displayMode 0 -windowwidth 1920 -windowheight 1200 -windowx 50 -windowy 50 --- Logging error --- [INFO 10:50:34] absl Connecting to: ws://127.0.0.1:24603/sc2api, attempt: 0, running: True --- Logging error --- [INFO 10:50:36] absl Connecting to: ws://127.0.0.1:24603/sc2api, attempt: 1, running: True --- Logging error --- [INFO 10:50:38] absl Connecting to: ws://127.0.0.1:24603/sc2api, attempt: 2, running: True --- Logging error --- [INFO 10:50:40] absl Connecting to: ws://127.0.0.1:24603/sc2api, attempt: 3, running: True --- Logging error --- [INFO 10:50:42] absl Connecting to: ws://127.0.0.1:24603/sc2api, attempt: 4, running: True --- Logging error --- C:\Users\nfitch3\Documents\Projects\DOES\PyMARL\src\components\episode_buffer.py:103: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requiresgrad(True), rather than torch.tensor(sourceTensor). v = th.tensor(v, dtype=dtype, device=self.device) [INFO 10:50:48] my_main t_env: 56 / 10000 --- Logging error --- [INFO 10:50:48] my_main Estimated time left: 13 seconds. Time passed: 13 seconds --- Logging error --- C:\Users\nfitch3\AppData\Local\Continuum\anaconda3\envs\does_tf2\lib\site-packages\torch\storage.py:34: FutureWarning: pickle support for Storage will be removed in 1.5. Use torch.save instead warnings.warn("pickle support for Storage will be removed in 1.5. Use torch.save instead", FutureWarning) [INFO 10:53:36] my_main Recent Stats | t_env: 10036 | Episode: 194 battle_won_mean: 0.0000 ep_length_mean: 56.0000 epsilon: 1.0000 grad_norm: 2.7521 loss: 0.1571 q_taken_mean: 0.0040 return_mean: 3.6838 return_std: 0.0000 target_mean: 0.0636 td_error_abs: 0.3103 test_battle_won_mean: 0.0000 test_ep_length_mean: 43.5000 test_return_mean: 0.0000 test_return_std: 0.0000 --- Logging error --- [INFO 10:53:36] absl Shutdown gracefully. --- Logging error --- [INFO 10:53:36] absl Shutdown with return code: 1 --- Logging error --- [INFO 10:53:36] my_main Finished Training --- Logging error --- [DEBUG 10:53:36] pymarl Stopping Heartbeat [ERROR 10:53:36] pymarl Failed after 0:03:02! Traceback (most recent calls WITHOUT Sacred internals): File "src/main.py", line 36, in my_main run(_run, config, _log) File "C:\Users\nfitch3\Documents\Projects\DOES\PyMARL\src\run.py", line 51, in run print("Exiting Main") OSError: [WinError 1] Incorrect function

Exiting Main`

lion6cheng commented 3 years ago

I met this problem too, have you solve this?

rezashami commented 2 years ago

I had this problem too. I changed some lines of codes and could run the experiment. For fixing this issue, first, you need to change 'fd' in this line into 'sys' if you run this experiment on windows. Next, you need to change the os.EX_OK to 1 in this line