mnelab: RuntimeError('context has already been set')

after installing 0.5.1 on Ubuntu I got following error:

Traceback (most recent call last):
  File "/home/daniel/.local/bin/mnelab", line 8, in <module>
    sys.exit(main())
  File "/home/daniel/.local/lib/python3.6/site-packages/mnelab/__main__.py", line 27, in main
    mp.set_start_method("spawn")  # required for Linux/macOS
  File "/usr/lib/python3.6/multiprocessing/context.py", line 242, in set_start_method
    raise RuntimeError('context has already been set')
RuntimeError: context has already been set

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

Running this twice on my computer (Python 3.6.8, Ipython 7.8.0)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import multiprocessing as mp
mp.set_start_method('spawn')

throw the same error, so it seems that at least on my computer when the Mnelab is starting the spawn is invoked more than once (but I don’t know how)

runfile('/home/daniel/PhD/notebooks/untitled1.py', wdir='/home/daniel/PhD/notebooks')
Traceback (most recent call last):

  File "/home/daniel/PhD/notebooks/untitled1.py", line 5, in <module>
    mp.set_start_method('spawn')

  File "/usr/lib/python3.6/multiprocessing/context.py", line 242, in set_start_method
    raise RuntimeError('context has already been set')

RuntimeError: context has already been set

Using force=TRUE solve the problem (see the issue I linked before)

mp.set_start_method('spawn', force=True)