-
Notifications
You must be signed in to change notification settings - Fork 11
Description
When attempting to run a standard DE fitting process, e.g.:
fit_1 = DE_fit.DEfit(pspl)
Python raises RunTimeErrors stemming from the multiprocessing library, which complains that the code is using 'spawn' to start the parallel tasks (rather than 'fork'). Note that this error is seen only under the following OS/Python versions:
OS: MacOS Ventura 13.4.1
Python: 3.11
This appears to relate this known issue in the multiprocessing library when running on MacOS.
When running a multiprocessing pool under Linux, the library uses a fork method but under MacOS it defaults to a spawn process, which introduces some additional constraints in the permitted configurations for the process.
More detailed information about this is available here.
Full traceback:
check_event : Everything looks fine...
check_event : Everything looks fine...
Traceback (most recent call last):
File "", line 1, in
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/spawn.py", line 120, in spawn_main
exitcode = _main(fd, parent_sentinel)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/spawn.py", line 129, in _main
prepare(preparation_data)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/spawn.py", line 240, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/spawn.py", line 291, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 291, in run_path
File "", line 98, in _run_module_code
File "", line 88, in _run_code
File "/Users/rstreet1/software/microlensing_project/python_scripts/gaia_pspl+usbl_noparallax/gaia21bsg_binary_noparallax_usbl.py", line 913, in
fit_1 = DE_fit.DEfit(pspl)
^^^^^^^^^^^^^^^^^^
File "/Users/rstreet1/software/pylima_venv3_11/lib/python3.11/site-packages/pyLIMA/fits/DE_fit.py", line 28, in init
super().init(model, rescale_photometry=rescale_photometry,
File "/Users/rstreet1/software/pylima_venv3_11/lib/python3.11/site-packages/pyLIMA/fits/ML_fit.py", line 67, in init
self.trials = Manager().list() # to be recognize by all process during
^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/context.py", line 57, in Manager
m.start()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/managers.py", line 563, in start
self._process.start()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/context.py", line 288, in _Popen
return Popen(process_obj)
^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/popen_spawn_posix.py", line 42, in _launch
prep_data = spawn.get_preparation_data(process_obj._name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/spawn.py", line 158, in get_preparation_data
_check_not_importing_main()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/spawn.py", line 138, in _check_not_importing_main
raise RuntimeError('''
RuntimeError:
An attempt has been made to start a new process before the
current process has finished its bootstrapping phase.
This probably means that you are not using fork to start your
child processes and you have forgotten to use the proper idiom
in the main module:
if __name__ == '__main__':
freeze_support()
...
The "freeze_support()" line can be omitted if the program
is not going to be frozen to produce an executable.
Traceback (most recent call last):
File "/Users/rstreet1/software/microlensing_project/python_scripts/gaia_pspl+usbl_noparallax/gaia21bsg_binary_noparallax_usbl.py", line 913, in
fit_1 = DE_fit.DEfit(pspl)
^^^^^^^^^^^^^^^^^^
File "/Users/rstreet1/software/pylima_venv3_11/lib/python3.11/site-packages/pyLIMA/fits/DE_fit.py", line 28, in init
super().init(model, rescale_photometry=rescale_photometry,
File "/Users/rstreet1/software/pylima_venv3_11/lib/python3.11/site-packages/pyLIMA/fits/ML_fit.py", line 67, in init
self.trials = Manager().list() # to be recognize by all process during
^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/context.py", line 57, in Manager
m.start()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/managers.py", line 567, in start
self._address = reader.recv()
^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/connection.py", line 249, in recv
buf = self._recv_bytes()
^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/connection.py", line 413, in _recv_bytes
buf = self._recv(4)
^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/multiprocessing/connection.py", line 382, in _recv
raise EOFError
EOFError
Process finished with exit code 1