rl
rl copied to clipboard
Bug: ValueError: cannot find context for 'fork' breaks 10 tutorials on Windows
Describe the bug
When running the TorchRL tutorials on Windows, the scripts crash immediately with a ValueError. This happens because the tutorials explicitly attempt to set the multiprocessing start method to "fork", but the "fork" method is not supported on Windows (which only supports "spawn").
This affects 10 different tutorials in the tutorials/sphinx-tutorials/ directory that all hardcode multiprocessing.set_start_method("fork").
The affected files are:
coding_ppo.pycoding_ddpg.pycoding_dqn.pydqn_with_rnn.pymulti_task.pypendulum.pypretrained_models.pyrecurrent_sequence_training.pytorchrl_demo.pytorchrl_envs.py
To Reproduce
Steps to reproduce the behavior.
- Use a Windows machine.
- Clone the
pytorch/rlrepository. - Run any of the affected tutorial scripts from the root directory.
Expected behavior
The tutorial scripts should run successfully on Windows without crashing due to unsupported multiprocessing start methods.
Screenshots
N/A
System info
Describe the characteristic of your environment:
- Windows 10 / 11
- Python 3.12 (also affects other versions on Windows)
Checklist
- [x] I have checked that there is no similar bug in the repo (required)
- [x] I have read the documentation (required)
- [x] I have provided a minimal working example to reproduce the bug (required)
/assign