raw.plot() causing segmentation fault - does this represent an installation problem?

Hello all,

Apologies for asking for assistance with real basics, but I have sadly limited Python experience which is almost certainly the problem. I’m just trying to work my way through one of the very first tutorials, and every time I attempt to use the raw.plot() function I get a segmentation fault and the kernel reboots. I installed using the MNE-Python standalone installer, and was using spyder when attempting to work through the tutorial - no issues getting as far as loading data until attempting to use raw.plot()

I would prefer to avoid a laborious manual reinstall, but if that’s the advice I’ll try to fumble my way through a manual install (again - sadly, I’ve very limited python experience)!

raw.plot_psd works just fine, but the visualisation raw.plot() crashes every time.

I have tried using %gui qt5, updating qt - and although it’s obviously 2D visualisation I’m shooting for, I’ve uninstalled and reinstalled vtk and pyvista.

Thanks all for advice - apologies once more if I’ve missed an obvious fix in the install or tutorial instructions.

I’m using the following:
Platform: macOS-10.14.6-x86_64-i386-64bit
Python: 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:43:32) [Clang 12.0.1 ]
Executable: /Applications/MNE-Python/.mne-python/bin/python
mne: 1.0.3
PyQt5: 5.15.4

The code is exactly as per the introductory MEG/EEG anaylsis tutorial:
import os
import numpy as np
import mne
sample_data_folder = mne.datasets.sample.data_path()
sample_data_raw_file = os.path.join(sample_data_folder, ‘MEG’, ‘sample’, ‘sample_audvis_raw.fif’)
raw = mne.io.read_raw_fif(sample_data_raw_file)
raw.plot(duration=5, n_channels=30)

In case the exact error output is helpful:
Using qt as 2D backend.

Fatal Python error: Segmentation fault

Main thread:
Current thread 0x0000000112b455c0 (most recent call first):

  • File “/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/objc/_bridgesupport.py”, line 853 in createStructType*
  • File “/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/CoreFoundation/_metadata.py”, line 50 in *
  • File “”, line 241 in _call_with_frames_removed*
  • File “”, line 883 in exec_module*
  • File “”, line 688 in _load_unlocked*
  • File “”, line 1006 in _find_and_load_unlocked*
  • File “”, line 1027 in _find_and_load*
  • File “”, line 241 in _call_with_frames_removed*
  • File “”, line 1078 in _handle_fromlist*
  • File “/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/CoreFoundation/init.py”, line 10 in *
  • File “”, line 241 in _call_with_frames_removed*
  • File “”, line 883 in exec_module*
  • File “”, line 688 in _load_unlocked*
  • File “”, line 1006 in _find_and_load_unlocked*
  • File “”, line 1027 in _find_and_load*
  • File “/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/Foundation/init.py”, line 9 in *
  • File “”, line 241 in _call_with_frames_removed*
  • File “”, line 883 in exec_module*
  • File “”, line 688 in _load_unlocked*
  • File “”, line 1006 in _find_and_load_unlocked*
  • File “”, line 1027 in _find_and_load*
  • File “/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/mne/viz/backends/_utils.py”, line 142 in _init_mne_qtapp*
  • File “/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/mne_qt_browser/_pg_figure.py”, line 4594 in _init_browser*
  • File “/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/mne/viz/_figure.py”, line 654 in _get_browser*
  • File “/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/mne/viz/raw.py”, line 356 in plot_raw*
  • File “”, line 12 in plot_raw*
  • File “/Applications/MNE-Python/.mne-python/lib/python3.10/site-packages/mne/io/base.py”, line 1556 in plot*
  • File “/var/folders/_q/7b1nk1p964395vwt2tmt1vch0000gn/T/ipykernel_12480/1229894758.py”, line 1 in <cell line: 1>*

Restarting kernel…

Hello @ejstephens and welcome to the forum!

The oldest version of macOS that the installers are built and tested on is macOS 10.15 (Catalina).

Do you have any possibility to upgrade to this (or a newer) version of macOS?

Note that even if you do upgrade, I cannot guarantee everything will magically work. But it would be one potential limitation moved out of the way…

Best wishes,

Hi @ejstephens,

could you please also run:
pip show mne-qt-browser and pip show pyopengl

We reported segmentation faults in some cases on macOS a while ago but thought these issues were resolved already.

Best wishes

1 Like

Thank you Martin and Richard!
Richard I went ahead and upgraded my OS and that seems to have solved things…sadly has un-done a different bit of kit I use in Matlab, but MNE/raw.plot() seems to now be working as described.
Martin - I’m happy to still run pip show mne-qt-browser and pip show pyopengl if that would provide, but now that I’ve updated and the fault has sorted itself, I presume the output would be less useful.

Thanks again!

1 Like

Right, then it was probably the OS. I hope you can resolve your new issue with the matplab toolkit too.

1 Like