cannot use plot anymore - 2d qt crashes the kernel (Jupyter notebook).


I was going fine for six months or so, but within the last 2-4 weeks all of the plots started crashing my Jupyter Notebook kernel. I’ve tried reinstalling a bunch of pyqt things. However, I am a complete noob and nothing has worked. The error and my system info are below.

The following says “Using qt as 2D backend.” and then it just quits the kernel.

tstart = data_raw.annotations.onset[(data_raw.annotations.description) == ‘Instructions’]
data_raw.plot(n_channels=len(data_raw.ch_names), duration=120, show_scrollbars=True,
scalings=‘auto’, clipping=None, start=tstart);

(base) Breas-MacBook-Pro:fNIRS_ParticipantRawData breachouinard$ python -c “import mne; mne.sys_info()”
Platform: macOS-10.16-x86_64-i386-64bit
Python: 3.8.3 (default, Jul 2 2020, 11:26:31) [Clang 10.0.0 ]
Executable: /Users/breachouinard/opt/anaconda3/bin/python
CPU: i386: 4 cores
Memory: 16.0 GB

mne: 1.3.1
numpy: 1.22.3 {unknown linalg bindings}
scipy: 1.8.1
matplotlib: 3.2.2 {backend=MacOSX}

sklearn: 0.23.1
numba: 0.50.1
nibabel: 3.2.1
nilearn: 0.9.1
dipy: Not found
openmeeg: Not found
cupy: Not found
pandas: 1.4.1
pyvista: Not found
pyvistaqt: Not found
ipyvtklink: Not found
vtk: Not found
qtpy: 1.9.0 {PyQt5=5.15.2}
ipympl: 0.9.2
pyqtgraph: 0.13.2
pooch: v1.7.0

mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: 0.4.0
mne_connectivity: Not found
mne_icalabel: Not found

You could try if the Matplotlib backend works, i.e. mne.viz.set_browser_backend("matplotlib").

Thanks Clemens! I will try it. Yesterday I typed in “mne.viz.set_browser_backend(‘qt’)” before every single xxx.plot() command, and that seemed to work too. But it would be handy if I didn’t have to type it everytime, so I will try your fix as well. Cheers.

Brea Ch