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

Multiprocessing #180

Open
kt71079 opened this issue Jan 28, 2023 · 1 comment
Open

Multiprocessing #180

kt71079 opened this issue Jan 28, 2023 · 1 comment

Comments

@kt71079
Copy link

kt71079 commented Jan 28, 2023

I encountered following error:

hogehoge\pfrl-master\examples\atari>python train_ppo_ale.py

Output files are saved in results\20230128T163113.362308
Traceback (most recent call last):
  File "train_ppo_ale.py", line 334, in <module>
    main()
  File "train_ppo_ale.py", line 208, in main
    sample_env = make_batch_env(test=False)
  File "train_ppo_ale.py", line 201, in make_batch_env
    for idx, env in enumerate(range(args.num_envs))
  File "<my_env>\pfrl\lib\site-packages\pfrl\envs\multiprocess_vector_env.py", line 64, in __init__
    p.start()
  File "<my_env>\pfrl\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)
  File "<my_env>\pfrl\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "<my_env>\pfrl\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "<my_env>\pfrl\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
    reduction.dump(process_obj, to_child)
  File "<my_env>\pfrl\lib\multiprocessing\reduction.py", line 60, in dump
    ForkingPickler(file, protocol).dump(obj)
AttributeError: Can't pickle local object 'main.<locals>.make_env'
Exception ignored in: <function MultiprocessVectorEnv.__del__ at 0x000001142E2B0F78>
Traceback (most recent call last):
  File "<my_env>\pfrl\lib\site-packages\pfrl\envs\multiprocess_vector_env.py", line 71, in __del__
    if not self.closed:
AttributeError: 'MultiprocessVectorEnv' object has no attribute 'closed'

hogehoge\pfrl-master\examples\atari>
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<my_env>\pfrl\lib\multiprocessing\spawn.py", line 105, in spawn_main
    exitcode = _main(fd)
  File "<my_env>\pfrl\lib\multiprocessing\spawn.py", line 115, in _main
    self = reduction.pickle.load(from_parent)
EOFError: Ran out of input

This error seems to happen in multiprocessing module.

How can I solve this problem?

@prabhatnagarajan
Copy link
Contributor

Hi sorry for this extremely late reply. The fix for me was to move make_env outside of main.

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

2 participants