Hello everyone!
Iβm having problem using functions which use pyvistaqt for plotting. When I run the example script from the MNE-Python webiste:
from pathlib import Path
import mne
from mne.datasets import sample, spm_face, testing
from mne.io import (
read_raw_artemis123,
read_raw_bti,
read_raw_ctf,
read_raw_fif,
read_raw_kit,
)
from mne.viz import plot_alignment, set_3d_title
print(__doc__)
root_path = Path(mne.__file__).parent.absolute()
kwargs = dict(eeg=False, coord_frame="meg", show_axes=True, verbose=True)
raw = read_raw_fif(sample.data_path() / "MEG" / "sample" / "sample_audvis_raw.fif")
fig = plot_alignment(raw.info, meg=("helmet", "sensors"), **kwargs)
set_3d_title(figure=fig, title="Neuromag")
I get the following Segmentation fault
(mne)$ python MNE-plot-aligment-test.py
None
Opening raw data file /home/workma/mne_data/MNE-sample-data/MEG/sample/sample_audvis_raw.fif...
Read a total of 3 projection items:
PCA-v1 (1 x 102) idle
PCA-v2 (1 x 102) idle
PCA-v3 (1 x 102) idle
Range : 25800 ... 192599 = 42.956 ... 320.670 secs
Ready.
Using pyvistaqt 3d backend.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
Segmentation fault (core dumped)
If I add to the code
import os
os.environ["QT_API"] = "PyQT6"
I get rid of the message qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
, but the Segmentation fault (core dumped) stays. A blank black window pops up for 1 second, which previously does not occur.
My clean install on Fedora 38 (used conda create --override-channels --channel=conda-forge --name=mne mne
):
>>> mne.sys_info()
Platform Linux-6.2.14-300.fc38.x86_64-x86_64-with-glibc2.37
Python 3.10.11 | packaged by conda-forge | (main, May 10 2023, 18:58:44) [GCC 11.3.0]
Executable /home/workma/.var/miniconda3/envs/mne/bin/python
CPU (12 cores)
Memory 30.5 GB
Core
ββ mne 1.4.0
ββ numpy 1.23.5 (OpenBLAS 0.3.21 with 12 threads)
ββ scipy 1.10.1
ββ matplotlib 3.7.1 (backend=QtAgg)
ββ pooch 1.7.0
ββ jinja2 3.1.2
Numerical (optional)
ββ sklearn 1.2.2
ββ numba 0.56.4
ββ nibabel 5.1.0
ββ nilearn 0.10.1
ββ dipy 1.7.0
ββ openmeeg 2.5.6
ββ pandas 2.0.1
ββ unavailable cupy
Visualization (optional)
ββ pyvista 0.39.0 (OpenGL 4.6 (Core Profile) Mesa 23.0.3 via AMD Radeon RX 6650 XT (navi23, LLVM 16.0.1, DRM 3.49, 6.2.14-300.fc38.x86_64))
ββ pyvistaqt 0.0.0
ββ ipyvtklink 0.2.2
ββ vtk 9.2.6
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
ββ qtpy 2.3.1 (PyQt5=5.15.6)
ββ pyqtgraph 0.13.3
ββ mne-qt-browser 0.0.0
ββ unavailable ipympl
Ecosystem (optional)
ββ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline
Then I tried to install the pip version of MNE and pyvistaqt. I created a new conda env and installed pyvista and pyvistaqt etc. with pip. This is the mne.sys_info():
mne.sys_info()
Platform: Linux-6.2.14-300.fc38.x86_64-x86_64-with-glibc2.37
Python: 3.11.3 (main, Apr 19 2023, 23:54:32) [GCC 11.2.0]
Executable: /home/workma/.var/miniconda3/envs/mne-pip/bin/python
CPU: : 12 cores
Memory: 30.5 GB
mne: 1.3.1
numpy: 1.24.3 {unknown linalg bindings (threadpoolctl module not found: No module named 'threadpoolctl')}
scipy: 1.10.1
matplotlib: 3.7.1 {backend=QtAgg}
sklearn: Not found
numba: Not found
nibabel: Not found
nilearn: Not found
dipy: Not found
openmeeg: Not found
cupy: Not found
pandas: Not found
pyvista: 0.38.5 {OpenGL 4.6 (Core Profile) Mesa 23.0.3 via AMD Radeon RX 6650 XT (navi23, LLVM 16.0.1, DRM 3.49, 6.2.14-300.fc38.x86_64)}
pyvistaqt: 0.10.0
ipyvtklink: 0.2.3
vtk: 9.2.6
qtpy: 2.3.1 {PyQt5=5.15.2}
ipympl: Not found
pyqtgraph: Not found
pooch: v1.7.0
mne_bids: Not found
mne_nirs: Not found
mne_features: Not found
mne_qt_browser: Not found
mne_connectivity: Not found
mne_icalabel: Not found
If I add to the code
import os
os.environ["QT_API"] = "PyQT6"
I get the window
but when I close I get the error
HBox(children=(Text(value='', layout=Layout(margin='2px 0px 2px 0px', min_width='0px'), placeholder='Type a file name'), Button(icon='camera', layout=Layout(margin='2px 0px 2px 0px', min_width='0px'), style=ButtonStyle(), tooltip='Take a screenshot')))
/home/workma/.local/lib/python3.11/site-packages/pyvista/plotting/plotting.py:6510: UserWarning: Not within a jupyter notebook environment.
Ignoring ``jupyter_backend``.
warnings.warn(
Traceback (most recent call last):
File "/home/workma/DevExamples/MNEExample/MNE-plot-aligment-test.py", line 26, in <module>
fig = plot_alignment(raw.info, meg=("helmet", "sensors"), **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<decorator-gen-122>", line 10, in plot_alignment
File "/home/workma/.local/lib/python3.11/site-packages/mne/viz/_3d.py", line 833, in plot_alignment
renderer.show()
File "/home/workma/.local/lib/python3.11/site-packages/mne/viz/backends/_notebook.py", line 1460, in show
viewer.layout.width = None # unlock the fixed layout
^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'layout'
If I add to the code
import os
os.environ["QT_QPA_PLATFORM"] = "xcb"
I get no error, but the pplot hides in 1 s.
I apologize for my long post. Does someone know what could be the issue?