mne-tools / mne-tools/mne-python

Plotting 3D Backend Not Working - Mac M1

Open
#9,473 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

BUG
Dominant language
Python
Stars
3.5k
Forks
1.6k
Avg merge
1d 6h
Merged PRs (30d)
100

Description

Describe the bug

I'm trying to run the mne_inverse_envelope_correlation.py example locally on my Mac M1 13 inch, 2021, but get a RuntimeError: Could not load any valid 3D backend: pyvista, mayavi, notebook.

Expected results

I would expect that the conda install pyvista would make this work?

Actual results
Traceback (most recent call last):
  File "/Users/adam2392/Documents/mne-connectivity/examples/mne_inverse_envelope_correlation.py", line 100, in <module>
    brain = stc.plot(
  File "/Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages/mne/source_estimate.py", line 651, in plot
    brain = plot_source_estimates(
  File "<decorator-gen-153>", line 24, in plot_source_estimates
  File "/Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages/mne/viz/_3d.py", line 1765, in plot_source_estimates
    backend = _get_3d_backend()
  File "/Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages/mne/viz/backends/renderer.py", line 153, in _get_3d_backend
    raise RuntimeError(f'Could not load any valid 3D backend: '
RuntimeError: Could not load any valid 3D backend: pyvista, mayavi, notebook
(mne) adam2392@adams-mbp-2 mne-connectivity % pip install pyvista
Requirement already satisfied: pyvista in /Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages (0.31.1)
Requirement already satisfied: pillow in /Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages (from pyvista) (8.2.0)
Requirement already satisfied: numpy in /Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages (from pyvista) (1.20.3)
Requirement already satisfied: scooby>=0.5.1 in /Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages (from pyvista) (0.5.7)
Requirement already satisfied: imageio in /Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages (from pyvista) (2.9.0)
Requirement already satisfied: transforms3d==0.3.1 in /Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages (from pyvista) (0.3.1)
Requirement already satisfied: meshio<5.0,>=4.0.3 in /Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages (from pyvista) (4.4.6)
Requirement already satisfied: vtk in /Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages (from pyvista) (9.0.1)
Requirement already satisfied: appdirs in /Users/adam2392/miniforge3/envs/mne/lib/python3.8/site-packages (from pyvista) (1.4.4)
Additional information
>>> mne.sys_info()
Platform:      macOS-11.4-arm64-arm-64bit
Python:        3.8.10 | packaged by conda-forge | (default, May 11 2021, 06:27:18)  [Clang 11.1.0 ]
Executable:    /Users/adam2392/miniforge3/envs/mne/bin/python
CPU:           arm: 8 cores
Memory:        16.0 GB

mne:           0.23.0
numpy:         1.20.3 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy:         1.6.3
matplotlib:    3.4.2 {backend=MacOSX}

sklearn:       0.24.2
numba:         Not found
nibabel:       Not found
nilearn:       Not found
dipy:          Not found
cupy:          Not found
pandas:        1.2.4
mayavi:        Not found
pyvista:       0.31.1 {OpenGL 4.1 Metal - 71.6.4 via Apple M1}
vtk:           9.0.1
PyQt5:         Not found

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run examples/mne_inverse_envelope_correlation.py on the reported macOS ARM environment and inspect stc.plot in mne/viz/_3d.py and mne/viz/backends/renderer.py. Confirm why the installed pyvista/VTK backend is rejected, with the example producing its 3D plot without the RuntimeError as the completion criterion.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.