`demo_papag_in_py_repl.py` fails mysteriously
Closed this issue · 3 comments
See the following failure:
~/agentos$ rm -rf mlruns/ && python documentation/demos/demo_papag_in_py_repl.py
VirtualEnv: Running in Python venv at /home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226
Adding PAPAGRun to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PAPAGRUN.PAPAGRun'> w/o instantiating
Adding AtariEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_ATARIENV.AtariEnv'> w/o instantiating
Adding CartPoleEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_CARTPOLEENV.CartPoleEnv'> w/o instantiating
Adding A2C_ACKTR to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_A2C_ACKTR.A2C_ACKTR'> w/o instantiating
Adding PPO to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PPO.PPO'> w/o instantiating
Calling agent.__init__(**{'env_name': 'PongNoFrameskip-v4', 'algo_name': 'a2c'})
Calling agent.learn(**{'lr': 0.0007, 'clip_param': 0.2, 'value_loss_coef': 0.5, 'num_processes': 8, 'num_steps': 5, 'num_mini_batch': 32, 'log_interval': 10, 'entropy_coef': 0.01, 'num_env_steps': 25000})
VirtualEnv: Running in Python venv at /home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226
VirtualEnv: Running in Python venv at /home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226
VirtualEnv: Running in Python venv at /home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226
VirtualEnv: Running in Python venv at /home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226
VirtualEnv: Running in Python venv at /home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226
VirtualEnv: Running in Python venv at /home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226
VirtualEnv: Running in Python venv at /home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226
VirtualEnv: Running in Python venv at /home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226
Adding PAPAGRun to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PAPAGRUN.PAPAGRun'> w/o instantiating
Adding AtariEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_ATARIENV.AtariEnv'> w/o instantiating
Adding CartPoleEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_CARTPOLEENV.CartPoleEnv'> w/o instantiating
Adding A2C_ACKTR to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_A2C_ACKTR.A2C_ACKTR'> w/o instantiating
Adding PPO to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PPO.PPO'> w/o instantiating
Calling agent.__init__(**{'env_name': 'PongNoFrameskip-v4', 'algo_name': 'a2c'})
Calling agent.learn(**{'lr': 0.0007, 'clip_param': 0.2, 'value_loss_coef': 0.5, 'num_processes': 8, 'num_steps': 5, 'num_mini_batch': 32, 'log_interval': 10, 'entropy_coef': 0.01, 'num_env_steps': 25000})
Adding PAPAGRun to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PAPAGRUN.PAPAGRun'> w/o instantiating
Adding AtariEnv to agent
VirtualEnv: Running in outer Python environment
Adding PAPAGRun to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_ATARIENV.AtariEnv'> w/o instantiating
Adding CartPoleEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_CARTPOLEENV.CartPoleEnv'> w/o instantiating
Adding A2C_ACKTR to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_A2C_ACKTR.A2C_ACKTR'> w/o instantiating
Adding PPO to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PPO.PPO'> w/o instantiating
Calling agent.__init__(**{'env_name': 'PongNoFrameskip-v4', 'algo_name': 'a2c'})
getting <class 'AOS_MODULE_PAPAGRUN.PAPAGRun'> w/o instantiating
Adding AtariEnv to agent
VirtualEnv: Running in outer Python environment
Adding PAPAGRun to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_ATARIENV.AtariEnv'> w/o instantiating
Adding CartPoleEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PAPAGRUN.PAPAGRun'> w/o instantiating
getting <class 'AOS_MODULE_CARTPOLEENV.CartPoleEnv'> w/o instantiating
Adding A2C_ACKTR to agent
VirtualEnv: Running in outer Python environment
Adding AtariEnv to agent
VirtualEnv: Running in outer Python environment
Adding PAPAGRun to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_A2C_ACKTR.A2C_ACKTR'> w/o instantiating
Adding PPO to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PPO.PPO'> w/o instantiating
Calling agent.__init__(**{'env_name': 'PongNoFrameskip-v4', 'algo_name': 'a2c'})
getting <class 'AOS_MODULE_PAPAGRUN.PAPAGRun'> w/o instantiating
Adding AtariEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_ATARIENV.AtariEnv'> w/o instantiating
Adding CartPoleEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_CARTPOLEENV.CartPoleEnv'> w/o instantiating
Adding A2C_ACKTR to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_A2C_ACKTR.A2C_ACKTR'> w/o instantiating
Adding PPO to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PPO.PPO'> w/o instantiating
Calling agent.__init__(**{'env_name': 'PongNoFrameskip-v4', 'algo_name': 'a2c'})
getting <class 'AOS_MODULE_ATARIENV.AtariEnv'> w/o instantiating
Adding CartPoleEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_CARTPOLEENV.CartPoleEnv'> w/o instantiating
Adding A2C_ACKTR to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_A2C_ACKTR.A2C_ACKTR'> w/o instantiating
Adding PPO to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PPO.PPO'> w/o instantiating
Calling agent.__init__(**{'env_name': 'PongNoFrameskip-v4', 'algo_name': 'a2c'})
Adding PAPAGRun to agent
VirtualEnv: Running in outer Python environment
Adding PAPAGRun to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PAPAGRUN.PAPAGRun'> w/o instantiating
Adding AtariEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PAPAGRUN.PAPAGRun'> w/o instantiating
Adding AtariEnv to agent
VirtualEnv: Running in outer Python environment
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/forkserver.py", line 274, in main
code = _serve_one(child_r, fds,
File "/usr/lib/python3.9/multiprocessing/forkserver.py", line 313, in _serve_one
code = spawn._main(child_r, parent_sentinel)
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
prepare(preparation_data)
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "/usr/lib/python3.9/runpy.py", line 268, in run_path
return _run_module_code(code, init_globals, run_name,
File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/nickj/agentos/documentation/demos/demo_papag_in_py_repl.py", line 12, in <module>
learning_run = papag_agent.run_with_arg_set("learn", a2c_pong_arg_set)
File "/home/nickj/agentos/pcs/component.py", line 384, in run_with_arg_set
res = self.call_function_with_arg_set(obj, entry_point, args)
File "/home/nickj/agentos/pcs/component.py", line 400, in call_function_with_arg_set
result = fn(**fn_args)
File "/home/nickj/agentos/example_agents/papag/agent.py", line 200, in learn
envs = papag_make_vec_envs(
File "/home/nickj/agentos/example_agents/papag/agent.py", line 485, in papag_make_vec_envs
envs = SubprocVecEnv(envs)
File "/home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226/lib/python3.9/site-packages/stable_baselines3/common/vec_env/subproc_vec_env.py", line 109, in __init__
process.start()
File "/usr/lib/python3.9/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/usr/lib/python3.9/multiprocessing/context.py", line 291, in _Popen
return Popen(process_obj)
File "/usr/lib/python3.9/multiprocessing/popen_forkserver.py", line 35, in __init__
super().__init__(process_obj)
File "/usr/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "/usr/lib/python3.9/multiprocessing/popen_forkserver.py", line 42, in _launch
prep_data = spawn.get_preparation_data(process_obj._name)
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 134, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
getting <class 'AOS_MODULE_ATARIENV.AtariEnv'> w/o instantiating
Adding CartPoleEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_CARTPOLEENV.CartPoleEnv'> w/o instantiating
Adding A2C_ACKTR to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_ATARIENV.AtariEnv'> w/o instantiating
Adding CartPoleEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_A2C_ACKTR.A2C_ACKTR'> w/o instantiating
Adding PPO to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_CARTPOLEENV.CartPoleEnv'> w/o instantiating
getting <class 'AOS_MODULE_PPO.PPO'> w/o instantiating
Adding A2C_ACKTR to agent
Calling agent.__init__(**{'env_name': 'PongNoFrameskip-v4', 'algo_name': 'a2c'})
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_A2C_ACKTR.A2C_ACKTR'> w/o instantiating
Adding PPO to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PPO.PPO'> w/o instantiating
Calling agent.__init__(**{'env_name': 'PongNoFrameskip-v4', 'algo_name': 'a2c'})
Adding PAPAGRun to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PAPAGRUN.PAPAGRun'> w/o instantiating
Adding AtariEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_ATARIENV.AtariEnv'> w/o instantiating
Adding CartPoleEnv to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_CARTPOLEENV.CartPoleEnv'> w/o instantiating
Adding A2C_ACKTR to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_A2C_ACKTR.A2C_ACKTR'> w/o instantiating
Adding PPO to agent
VirtualEnv: Running in outer Python environment
getting <class 'AOS_MODULE_PPO.PPO'> w/o instantiating
Calling agent.__init__(**{'env_name': 'PongNoFrameskip-v4', 'algo_name': 'a2c'})
Calling agent.learn(**{'lr': 0.0007, 'clip_param': 0.2, 'value_loss_coef': 0.5, 'num_processes': 8, 'num_steps': 5, 'num_mini_batch': 32, 'log_interval': 10, 'entropy_coef': 0.01, 'num_env_steps': 25000})
Calling agent.learn(**{'lr': 0.0007, 'clip_param': 0.2, 'value_loss_coef': 0.5, 'num_processes': 8, 'num_steps': 5, 'num_mini_batch': 32, 'log_interval': 10, 'entropy_coef': 0.01, 'num_env_steps': 25000})
Calling agent.learn(**{'lr': 0.0007, 'clip_param': 0.2, 'value_loss_coef': 0.5, 'num_processes': 8, 'num_steps': 5, 'num_mini_batch': 32, 'log_interval': 10, 'entropy_coef': 0.01, 'num_env_steps': 25000})
Calling agent.learn(**{'lr': 0.0007, 'clip_param': 0.2, 'value_loss_coef': 0.5, 'num_processes': 8, 'num_steps': 5, 'num_mini_batch': 32, 'log_interval': 10, 'entropy_coef': 0.01, 'num_env_steps': 25000})
Calling agent.learn(**{'lr': 0.0007, 'clip_param': 0.2, 'value_loss_coef': 0.5, 'num_processes': 8, 'num_steps': 5, 'num_mini_batch': 32, 'log_interval': 10, 'entropy_coef': 0.01, 'num_env_steps': 25000})
Calling agent.learn(**{'lr': 0.0007, 'clip_param': 0.2, 'value_loss_coef': 0.5, 'num_processes': 8, 'num_steps': 5, 'num_mini_batch': 32, 'log_interval': 10, 'entropy_coef': 0.01, 'num_env_steps': 25000})
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/forkserver.py", line 274, in main
code = _serve_one(child_r, fds,
File "/usr/lib/python3.9/multiprocessing/forkserver.py", line 313, in _serve_one
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/forkserver.py", line 274, in main
Traceback (most recent call last):
File "/usr/lib/python3.9/multiprocessing/forkserver.py", line 274, in main
code = spawn._main(child_r, parent_sentinel)
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
code = _serve_one(child_r, fds,
File "/usr/lib/python3.9/multiprocessing/forkserver.py", line 313, in _serve_one
code = _serve_one(child_r, fds,
File "/usr/lib/python3.9/multiprocessing/forkserver.py", line 313, in _serve_one
code = spawn._main(child_r, parent_sentinel)
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
code = spawn._main(child_r, parent_sentinel)
prepare(preparation_data)
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
prepare(preparation_data)
_fixup_main_from_path(data['init_main_from_path'])
prepare(preparation_data)
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
main_content = runpy.run_path(main_path,
_fixup_main_from_path(data['init_main_from_path'])
_fixup_main_from_path(data['init_main_from_path'])
File "/usr/lib/python3.9/runpy.py", line 268, in run_path
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
main_content = runpy.run_path(main_path,
return _run_module_code(code, init_globals, run_name,
File "/usr/lib/python3.9/runpy.py", line 268, in run_path
File "/usr/lib/python3.9/runpy.py", line 268, in run_path
File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
return _run_module_code(code, init_globals, run_name,
return _run_module_code(code, init_globals, run_name,
File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
File "/usr/lib/python3.9/runpy.py", line 97, in _run_module_code
exec(code, run_globals)
File "/home/nickj/agentos/documentation/demos/demo_papag_in_py_repl.py", line 12, in <module>
_run_code(code, mod_globals, init_globals,
_run_code(code, mod_globals, init_globals,
learning_run = papag_agent.run_with_arg_set("learn", a2c_pong_arg_set)
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
File "/home/nickj/agentos/pcs/component.py", line 384, in run_with_arg_set
exec(code, run_globals)
exec(code, run_globals)
File "/home/nickj/agentos/documentation/demos/demo_papag_in_py_repl.py", line 12, in <module>
File "/home/nickj/agentos/documentation/demos/demo_papag_in_py_repl.py", line 12, in <module>
res = self.call_function_with_arg_set(obj, entry_point, args)
learning_run = papag_agent.run_with_arg_set("learn", a2c_pong_arg_set)
learning_run = papag_agent.run_with_arg_set("learn", a2c_pong_arg_set)
File "/home/nickj/agentos/pcs/component.py", line 400, in call_function_with_arg_set
File "/home/nickj/agentos/pcs/component.py", line 384, in run_with_arg_set
File "/home/nickj/agentos/pcs/component.py", line 383, in run_with_arg_set
result = fn(**fn_args)
res = self.call_function_with_arg_set(obj, entry_point, args)
obj = self.get_object(arg_set=args)
File "/home/nickj/agentos/example_agents/papag/agent.py", line 200, in learn
File "/home/nickj/agentos/pcs/component.py", line 400, in call_function_with_arg_set
File "/home/nickj/agentos/pcs/component.py", line 426, in get_object
envs = papag_make_vec_envs(
File "/home/nickj/agentos/example_agents/papag/agent.py", line 485, in papag_make_vec_envs
result = fn(**fn_args)
File "/home/nickj/agentos/example_agents/papag/agent.py", line 200, in learn
return self._get_object(arg_set, collected)
File "/home/nickj/agentos/pcs/component.py", line 448, in _get_object
envs = papag_make_vec_envs(
envs = SubprocVecEnv(envs)
File "/home/nickj/agentos/example_agents/papag/agent.py", line 485, in papag_make_vec_envs
File "/home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226/lib/python3.9/site-packages/stable_baselines3/common/vec_env/subproc_vec_env.py", line 109, in __init__
self.call_function_with_arg_set(obj, "__init__", arg_set)
File "/home/nickj/agentos/pcs/component.py", line 400, in call_function_with_arg_set
process.start()
File "/usr/lib/python3.9/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
envs = SubprocVecEnv(envs)
File "/usr/lib/python3.9/multiprocessing/context.py", line 291, in _Popen
File "/home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226/lib/python3.9/site-packages/stable_baselines3/common/vec_env/subproc_vec_env.py", line 109, in __init__
result = fn(**fn_args)
File "/home/nickj/agentos/example_agents/papag/agent.py", line 49, in __init__
process.start()
File "/usr/lib/python3.9/multiprocessing/process.py", line 121, in start
self.model_input_run = self.PAPAGRun.get_last_logged_model_run(
File "/home/nickj/agentos/example_agents/papag/papag_run.py", line 67, in get_last_logged_model_run
return Popen(process_obj)
File "/usr/lib/python3.9/multiprocessing/popen_forkserver.py", line 35, in __init__
cls._get_artifact_path(run, name)
self._popen = self._Popen(self)
super().__init__(process_obj)
File "/usr/lib/python3.9/multiprocessing/context.py", line 291, in _Popen
File "/home/nickj/agentos/example_agents/papag/papag_run.py", line 53, in _get_artifact_path
File "/usr/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "/usr/lib/python3.9/multiprocessing/popen_forkserver.py", line 42, in _launch
return cls._mlflow_client.download_artifacts(run.info.run_id, name)
File "/home/nickj/agentos/lean-env/lib/python3.9/site-packages/mlflow/tracking/client.py", line 1413, in download_artifacts
prep_data = spawn.get_preparation_data(process_obj._name)
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 154, in get_preparation_data
return Popen(process_obj)
File "/usr/lib/python3.9/multiprocessing/popen_forkserver.py", line 35, in __init__
super().__init__(process_obj)
_check_not_importing_main()
File "/usr/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 134, in _check_not_importing_main
self._launch(process_obj)
File "/usr/lib/python3.9/multiprocessing/popen_forkserver.py", line 42, in _launch
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable. prep_data = spawn.get_preparation_data(process_obj._name)
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "/usr/lib/python3.9/multiprocessing/spawn.py", line 134, in _check_not_importing_main
return self._tracking_client.download_artifacts(run_id, path, dst_path)
raise RuntimeError('''
File "/home/nickj/agentos/lean-env/lib/python3.9/site-packages/mlflow/tracking/_tracking_service/client.py", line 391, in download_artifacts
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
return self._get_artifact_repo(run_id).download_artifacts(path, dst_path)
File "/home/nickj/agentos/lean-env/lib/python3.9/site-packages/mlflow/tracking/_tracking_service/client.py", line 328, in _get_artifact_repo
run = self.get_run(run_id)
File "/home/nickj/agentos/lean-env/lib/python3.9/site-packages/mlflow/tracking/_tracking_service/client.py", line 69, in get_run
return self.store.get_run(run_id)
File "/home/nickj/agentos/lean-env/lib/python3.9/site-packages/mlflow/store/tracking/file_store.py", line 532, in get_run
run_info = self._get_run_info(run_id)
File "/home/nickj/agentos/lean-env/lib/python3.9/site-packages/mlflow/store/tracking/file_store.py", line 554, in _get_run_info
run_info = self._get_run_info_from_dir(run_dir)
File "/home/nickj/agentos/lean-env/lib/python3.9/site-packages/mlflow/store/tracking/file_store.py", line 563, in _get_run_info_from_dir
run_info = _read_persisted_run_info_dict(meta)
File "/home/nickj/agentos/lean-env/lib/python3.9/site-packages/mlflow/store/tracking/file_store.py", line 104, in _read_persisted_run_info_dict
dict_copy = run_info_dict.copy()
AttributeError: 'NoneType' object has no attribute 'copy'
Traceback (most recent call last):
File "/home/nickj/agentos/documentation/demos/demo_papag_in_py_repl.py", line 12, in <module>
learning_run = papag_agent.run_with_arg_set("learn", a2c_pong_arg_set)
File "/home/nickj/agentos/pcs/component.py", line 384, in run_with_arg_set
res = self.call_function_with_arg_set(obj, entry_point, args)
File "/home/nickj/agentos/pcs/component.py", line 400, in call_function_with_arg_set
result = fn(**fn_args)
File "/home/nickj/agentos/example_agents/papag/agent.py", line 200, in learn
envs = papag_make_vec_envs(
File "/home/nickj/agentos/example_agents/papag/agent.py", line 485, in papag_make_vec_envs
envs = SubprocVecEnv(envs)
File "/home/nickj/.agentos/cache/requirements_cache/python3.9/6ca95402f3200676689cbf632041895fb1b022e6c898c9bfc4439e4fcb0bb226/lib/python3.9/site-packages/stable_baselines3/common/vec_env/subproc_vec_env.py", line 118, in __init__
observation_space, action_space = self.remotes[0].recv()
File "/usr/lib/python3.9/multiprocessing/connection.py", line 255, in recv
buf = self._recv_bytes()
File "/usr/lib/python3.9/multiprocessing/connection.py", line 419, in _recv_bytes
buf = self._recv(4)
File "/usr/lib/python3.9/multiprocessing/connection.py", line 384, in _recv
chunk = read(handle, remaining)
ConnectionResetError: [Errno 104] Connection reset by peer
@andyk the real root of the failure is still a bit mysterious to me, but it happens when PAPAG launches a bunch of worker processes to generate experience. To launch these processes, PAPAG uses the stable_baselines3's SubprocVecEnv wrapper.
By default, this wrapper uses the 'forkserver' process start_method (on my box, at least). However, something goes horribly wrong when we start a worker using this method: the worker restarts running the whole demo_papag_in_py_repl.py
script from the top instead of running the target function. I do not know why this happens, although there is a warning about calling freeze_support()
in the error message, so that may be related.
Ultimately, it seems like there's a relatively straightforward fix (use the 'fork' start method) that resolves the issue on my box (although, I have not deeply researched the deeper implications of using 'fork' vs 'forkserver'). I'll push to the branch shortly so you can also try.
This is fixed in master now!