stc.plot() crash in macOS Monterey(12.0.1)

  • MNE version: mne-base 0.24.0, mne-qt-browser 0.1.6
  • operating system: macOS 12 (M1 Pro)

I ran the example code

import os

import os.path as op

import numpy as np

import matplotlib.pyplot as plt

import matplotlib

import mne

from mne.datasets import sample, fetch_hcp_mmp_parcellation

from mne.minimum_norm import apply_inverse, read_inverse_operator

from mne import read_evokeds

os.environ['ETS_TOOLKIT'] = 'qt4'

os.environ['QT_API'] = 'pyqt5'

# os.environ['MNE_3D_OPTION_ANTIALIAS'] = 'false'

data_path = sample.data_path()

sample_dir = op.join(data_path, 'MEG', 'sample')

subjects_dir = op.join(data_path, 'subjects')

fname_evoked = op.join(data_path, 'MEG', 'sample', 'sample_audvis-ave.fif')

fname_stc = op.join(sample_dir, 'sample_audvis-meg')

fetch_hcp_mmp_parcellation(subjects_dir)

stc = mne.read_source_estimate(fname_stc, subject='sample')

print(stc)

initial_time = 0.1

brain = stc.plot(subjects_dir=subjects_dir, initial_time=initial_time, clim=dict(kind='value', lims=[3, 6, 9]))

and the plot just show for a second than crashed, and showed below error message:

Using pyvistaqt 3d backend.

Traceback (most recent call last):
  File "/Users/PPMc/miniforge3/envs/TPSE/lib/python3.8/site-packages/pyvistaqt/plotting.py", line 581, in close
    self.app_window.close()
RuntimeError: wrapped C/C++ object of type MainWindow has been deleted
zsh: abort      /Users/PPMc/miniforge3/envs/TPSE/bin/python

and I can’t found out why and how can I solve this issue.

Hello @tPPMc-cs, M1 machines are still a little bit difficult to set up correctly for MNE. This will be improved over the course of the next few months, but for now it’s not a really smooth experience.

@Denis just reported on Twitter how he got things to work on his M1:

I hope that helps!

Best wishes,
Richard

i followed the steps that

have been posted,

  1. mamba create -n <my_env_name> mne
  2. pip install vtk mayavi
  3. conda install -c andfoy pyqt5-sip
  4. pip install pyvista
  5. pip install pyvistaqt
    but i still get errors:
    RuntimeError: wrapped C/C++ object of type _VTKRenderWindowInteractor has been deleted!

which packages that mamba had been installed? :pray:

Hello @tPPMc-cs,

I will only get my hands on an Apple Silicon machine within the next couple of days; until then, I cannot really help you, I’m afraid :frowning: But maybe @Denis will find some time before that. Otherwise, unfortunately you’ll have to be patient.

Best wishes,
Richard

@richard
so thankful for your patient reply~
I will be grateful if you can answer my question after you get your Apple Silicon machine~ :pray: :grinning:

sincerely,
Teddy

Hi Richard,
How is it going? Did it worked on M1 MacbookPro?

sincerely,
Teddy

Hello @tPPMc-cs, unfortunately I did not yet have time to try this one out due to the pandemic and the holiday season. I’ll try to do it next week, ok? I’ll keep you posted.

Best wishes,
Richard