scikit-opt icon indicating copy to clipboard operation
scikit-opt copied to clipboard

Fix RuntimeError: context has already been set

Open JesseSenior opened this issue 2 years ago • 1 comments

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

JesseSenior avatar Dec 23 '23 15:12 JesseSenior

I had the same issue on my system. Could we look into solving it or accept this fix?

emil-peters avatar Feb 06 '24 14:02 emil-peters

thank you!

guofei9987 avatar Jun 23 '24 12:06 guofei9987