diff --git a/vip_hci/config/utils_conf.py b/vip_hci/config/utils_conf.py index c5d42fd8..2b24a9b7 100644 --- a/vip_hci/config/utils_conf.py +++ b/vip_hci/config/utils_conf.py @@ -15,6 +15,7 @@ from inspect import signature, Parameter from functools import wraps import multiprocessing +import warnings from vip_hci import __version__ sep = "―" * 80 @@ -475,9 +476,16 @@ def pool_map(nproc, fkt, *args, **kwargs): avail_methods = multiprocessing.get_all_start_methods() if 'fork' in avail_methods: # faster when available - multiprocessing.set_start_method("fork", force=True) + warnings.filterwarnings("error") # allows to catch warning as error + try: + multiprocessing.set_start_method("fork", force=True) + except (DeprecationWarning, OSError): + multiprocessing.set_start_method("spawn", force=True) + elif 'forkserver' in avail_methods: + multiprocessing.set_start_method("forkserver", force=True) else: multiprocessing.set_start_method("spawn", force=True) + warnings.resetwarnings() # reset warning behaviour to default from multiprocessing import Pool # deactivate multithreading