nolitsa
nolitsa copied to clipboard
Error in fnn test
I wrote a fnn test:
tau=3
x = np.linspace(0, 10, 1000)
dim = np.arange(1, max_dim)
f1, f2, f3 = dimension.fnn(x, tau=tau, dim=dim)
print(f1)
Program doesn't reach print(f1), instead gives the following error after getting stuck for several seconds:
File "C:\Users\Carlos\PycharmProjects\parkinson.venv\Lib\site-packages\nolitsa\dimension.py", line 187, in fnn r = utils.parallel_map(_fnn, dim, (x,), { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Carlos\PycharmProjects\parkinson.venv\Lib\site-packages\nolitsa\utils.py", line 247, in parallel_map pool = Pool(processes=processes) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\context.py", line 119, in Pool return Pool(processes, initializer, initargs, maxtasksperchild, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 215, in init self._repopulate_pool() File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 306, in _repopulate_pool return self._repopulate_pool_static(self._ctx, self.Process, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\pool.py", line 329, in _repopulate_pool_static w.start() File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\process.py", line 121, in start self._popen = self._Popen(self) ^^^^^^^^^^^^^^^^^ File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\context.py", line 337, in _Popen return Popen(process_obj) ^^^^^^^^^^^^^^^^^^ File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\popen_spawn_win32.py", line 45, in init prep_data = spawn.get_preparation_data(process_obj._name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 164, in get_preparation_data _check_not_importing_main() File "C:\Users\Carlos\AppData\Local\Programs\Python\Python312\Lib\multiprocessing\spawn.py", line 140, 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. To fix this issue, refer to the "Safe importing of main module" section in https://docs.python.org/3/library/multiprocessing.html