mne.gui.coregistration crashing, maybe a mayavi issue

External Email - Use Caution

Dear all,

I'm using mne python for source reconstruction and need to align my coordinate frames, using mne.gui.coregistration. However, it is crashing and I don't know how to fix it. The GUI box briefly flashes, disappears, and then my kernel restarts.

I'm using spyder from within anaconda, and my sys_info is:
mne sys_info
Platform: Linux-5.3.0-61-generic-x86_64-with-debian-buster-sid
Python: 3.7.6 (default, Jan 8 2020, 19:59:22) [GCC 7.3.0]
Executable: /home/developer/anaconda3/bin/python
CPU: x86_64: 6 cores
Memory: 19.8 GB

mne: 0.20.7
numpy: 1.18.1 {blas=mkl_rt, lapack=mkl_rt}
scipy: 1.4.1
matplotlib: 3.1.3 {backend=Qt5Agg}

sklearn: 0.22.1
numba: 0.48.0
nibabel: 3.1.1
cupy: Not found
pandas: 1.0.1
dipy: 1.1.1
mayavi: 4.7.2.dev0 {qt_api=pyqt5, PyQt5=5.10}
pyvista: 0.25.3
vtk: 9.0.1

The linux platform is running through a virtual machine on my windows computer - I need to do it this way because some of the mne commands need freesurfer and that is in linux. In case it is relevant: before crashing, memory usage is around 16GB (almost 20 GB are assigned to the virtual machine, out of 32GB total).

If I type mne coreg into the command line I get:
mne coreg
Stack dump:
Fatal Python error: Segmentation fault

Thread 0x00007fc9da677700 (most recent call first):
  File "/home/developer/anaconda3/lib/python3.7/threading.py", line 296 in wait
  File "/home/developer/anaconda3/lib/python3.7/queue.py", line 170 in get
  File "/home/developer/anaconda3/lib/python3.7/site-packages/mne/gui/_coreg_gui.py", line 1368 in worker
  File "/home/developer/anaconda3/lib/python3.7/threading.py", line 870 in run
  File "/home/developer/anaconda3/lib/python3.7/threading.py", line 926 in _bootstrap_inner
  File "/home/developer/anaconda3/lib/python3.7/threading.py", line 890 in _bootstrap

Current thread 0x00007fca60f2d740 (most recent call first):
  File "/home/developer/anaconda3/lib/python3.7/site-packages/tvtk/pyface/ui/qt4/QVTKRenderWindowInteractor.py", line 370 in paintEvent
  File "/home/developer/anaconda3/lib/python3.7/site-packages/tvtk/pyface/ui/qt4/scene.py", line 69 in paintEvent
  File "/home/developer/anaconda3/lib/python3.7/site-packages/pyface/util/guisupport.py", line 137 in start_event_loop_qt4
  File "/home/developer/anaconda3/lib/python3.7/site-packages/traitsui/qt4/view_application.py", line 132 in __init__
  File "/home/developer/anaconda3/lib/python3.7/site-packages/traitsui/qt4/view_application.py", line 85 in view_application
  File "/home/developer/anaconda3/lib/python3.7/site-packages/traitsui/qt4/toolkit.py", line 224 in view_application
  File "/home/developer/anaconda3/lib/python3.7/site-packages/traits/has_traits.py", line 2351 in configure_traits
  File "/home/developer/anaconda3/lib/python3.7/site-packages/mne/gui/__init__.py", line 18 in _initialize_gui
  File "/home/developer/anaconda3/lib/python3.7/site-packages/mne/gui/__init__.py", line 180 in coregistration
  File "<decorator-gen-421>", line 21 in coregistration
  File "/home/developer/anaconda3/lib/python3.7/site-packages/mne/commands/mne_coreg.py", line 118 in run
  File "/home/developer/anaconda3/lib/python3.7/site-packages/mne/commands/utils.py", line 107 in main
  File "/home/developer/anaconda3/bin/mne", line 8 in <module>
Segmentation fault (core dumped)

I think this could be a mayavi issue because I also cannot launch mne.viz.plot_alignment(), as a mayavi image object is created that remains blank, crashes the computer, and I have to restart. I saw in a git issue some other people had seg fault issues and one check was to test with mlab.test_plot3d(), which crashes the kernel and then brings up warnings when the kernel restarts itself.

Am I doing something entirely stupid? Does anyone know why this might not work and how I can make it work?

Best,

Amie

External Email - Use Caution

Have you tried with

export MESA_GL_VERSION_OVERRIDE=3.3
export MNE_3D_OPTION_ANTIALIAS=false

before launching mne?

On my virtual linux machines this lets me get some visualization,
although I still have some issues with seeing the fiducial points,
depending on opacity levels.

Luke

External Email - Use Caution

I'm not sure but I think pyvista 0.25.3 is only compatible with latest development version of MNE-python? You could try downgrading:
pip install pyvista=0.24

-- dan
Daniel McCloy
https://dan.mccloy.info
Research Scientist
Institute for Learning and Brain Sciences
University of Washington