-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError at training due to multiprocessing #29
Comments
Hello, Could you try to import reservoirpy from within the 'if name == "main":' statement ? PS: Thank you for using reservoirpy, we are glad you like it :) |
Thank you for the quick reply:) Yes, I tried adding it into an 'if name == "main":' statement but still getting this RuntimeError. However, what is very odd that actually the code does not stop at the error. Now I added some additional code after this error is printed in the terminal and that runs. Do you have an idea what's happenning? Sorry, I am new to Python, so I might miss something basic. Pleas the script below that I use: def split_timeserie_for_task1(forecast, train_length=20000):
def reset_esn():
def r2_score(y_true, y_pred): def nrmse(y_true, y_pred): if name == 'main':
|
Hello, |
Thanks a lot for trying to fix this and the help with the workaround. Feel free to let me know if I can be helpful in any testing. |
Hi,
Congrats on this great tool. I wanted to give it a go but I get the error below when I train a reservoir (see reservoir.train) in Introduction_to_RC.ipynb.
I ran the code on macOS Big Sur (Version 11.6.1) and tried both jupiter notebook and copy-pasting the relevant code into a script then using visual studio code (in this case, I even embedded the script in if name == 'main' and called freeze_support() as suggested in forums but with no success).
Please can you help me how to resolve this issue?
Thanks a lot and Best,
Agoston
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 126, in _main
self = reduction.pickle.load(from_parent)
File "/Users/amihalik/Documents/projects/reservoir/vsc-test/.venv/lib/python3.9/site-packages/reservoirpy/init.py", line 6, in
from .utils.save import load
File "/Users/amihalik/Documents/projects/reservoir/vsc-test/.venv/lib/python3.9/site-packages/reservoirpy/utils/save.py", line 11, in
from .. import regression_models
File "/Users/amihalik/Documents/projects/reservoir/vsc-test/.venv/lib/python3.9/site-packages/reservoirpy/regression_models.py", line 22, in
from .utils.parallel import lock as global_lock
File "/Users/amihalik/Documents/projects/reservoir/vsc-test/.venv/lib/python3.9/site-packages/reservoirpy/utils/parallel.py", line 17, in
manager = Manager()
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 57, in Manager
m.start()
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/managers.py", line 554, in start
self._process.start()
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in init
super().init(process_obj)
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in init
self._launch(process_obj)
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 42, in _launch
prep_data = spawn.get_preparation_data(process_obj._name)
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "/usr/local/Cellar/python@3.9/3.9.8/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/spawn.py", line 134, 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.
The text was updated successfully, but these errors were encountered: