mne-realtime
mne-realtime copied to clipboard
BUG: Get LSLMockClient to work on multiprocessing
Windows is causing some problems with multiprocessing in Python. look into this more
I also meet this BUG .
Hi,
I'm a beginner to MNE and trying to use mne-realtime on my Windows 10 PC. I was running the example code plot_lslclient_rt.py and received the following bug reports:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Program Files\Python310\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "D:\Program Files\Python310\lib\multiprocessing\spawn.py", line 125, in _main
prepare(preparation_data)
File "D:\Program Files\Python310\lib\multiprocessing\spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "D:\Program Files\Python310\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "D:\Program Files\Python310\lib\runpy.py", line 269, in run_path
return _run_module_code(code, init_globals, run_name,
File "D:\Program Files\Python310\lib\runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "D:\Program Files\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "d:\WJZ\mne\plot_lslclient_rt.py", line 39, in <module>
with MockLSLStream(host, raw, 'eeg'):
File "D:\Program Files\Python310\lib\site-packages\mne_realtime\mock_lsl_stream.py", line 59, in __enter__
self.start()
File "D:\Program Files\Python310\lib\site-packages\mne_realtime\mock_lsl_stream.py", line 46, in start
self.process.start()
File "D:\Program Files\Python310\lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
File "D:\Program Files\Python310\lib\multiprocessing\context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "D:\Program Files\Python310\lib\multiprocessing\context.py", line 327, in _Popen
return Popen(process_obj)
File "D:\Program Files\Python310\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
prep_data = spawn.get_preparation_data(process_obj._name)
File "D:\Program Files\Python310\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
_check_not_importing_main()
File "D:\Program Files\Python310\lib\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.
Is this bug ralated to this issue #9? Am I missing something or could u plz tell me if there's a way to solve this problem? Thanks!
Same bug. currently I can't find where to put freeze_support() properly.
hi @iPsych @Asudy, sorry for the delay, I haven't been working on this project in a while. I believe the multiprocessing on Windows has been resolved. I think if there's a problem, it might be elsewhere.
how are you currently running the example? are you using python mne-realtime/examples/plot_lslclient_rt.py