scikit-opt
scikit-opt copied to clipboard
Fix RuntimeError: context has already been set
After invoking torch.multiprocessing.set_start_method, importing sko will result in "RuntimeError: context has already been set". Here is a simple code to reproduce it(to be run in a non-win32 environment).
import torch.multiprocessing as mp
mp.set_start_method("spawn")
import sko # <-- RuntimeError occurs.
This pull request should fix it. (Reference: https://github.com/pytorch/pytorch/issues/3492#issuecomment-392977006) Possible related Issue: #146
I had the same issue on my system. Could we look into solving it or accept this fix?
thank you!