I am trying to set up mne to work on an headless server, I am not an expert and it is the first time that I do it so I may be facing a stupid issue. Anyway, I created a new environment on the server using conda following these instructions:
Advanced setup β MNE 1.7.1 documentation
I ran this:
conda create --override-channels --channel=conda-forge --name=mne mne "vtk>=9.2=*osmesa*" "mesalib=21.2.5" -y
Activated the environmet and ran a very simple code snipped just to test it
import mne
from mne.io import read_raw_egi
from pathlib import Path
mff_file = Path('RawData/33/PDGS_02_33_01_01_20190201_111423.mff')
raw = read_raw_egi(mff_file, preload=True)
raw.compute_psd(fmax=50).plot(picks="data", exclude="bads", amplitude=False)
raw.plot(duration=5, n_channels=30)
Error:
Using qt as 2D backend.
Traceback (most recent call last):
File "/mnt/S/edoardoStorage/EEG/test1.py", line 100, in <module>
raw.plot(duration=5, n_channels=30)
File "/home/edoardo/miniconda3/envs/mne/lib/python3.9/site-packages/mne/io/base.py", line 1856, in plot
return plot_raw(
File "<decorator-gen-179>", line 12, in plot_raw
File "/home/edoardo/miniconda3/envs/mne/lib/python3.9/site-packages/mne/viz/raw.py", line 409, in plot_raw
fig = _get_browser(show=show, block=block, **params)
File "/home/edoardo/miniconda3/envs/mne/lib/python3.9/site-packages/mne/viz/_figure.py", line 698, in _get_browser
fig = backend._init_browser(**kwargs)
File "/home/edoardo/miniconda3/envs/mne/lib/python3.9/site-packages/mne_qt_browser/_pg_figure.py", line 5173, in _init_browser
out = _init_mne_qtapp(pg_app=True, **app_kwargs)
File "/home/edoardo/miniconda3/envs/mne/lib/python3.9/site-packages/mne/viz/backends/_utils.py", line 162, in _init_mne_qtapp
raise RuntimeError("Cannot connect to a valid display")
RuntimeError: Cannot connect to a valid display
mne sys_info
Platform Linux-3.10.0-1160.el7.x86_64-x86_64-with-glibc2.17
Python 3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:49:32) [GCC 12.3.0]
Executable /home/edoardo/miniconda3/envs/mne/bin/python3.9
CPU x86_64 (32 cores)
Memory 251.3 GB
Core
ββ mne 1.7.1 (latest release)
ββ numpy 1.26.4 (OpenBLAS 0.3.27 with 32 threads)
ββ scipy 1.13.1
ββ matplotlib 3.9.1 (backend=agg)
Numerical (optional)
ββ sklearn 1.5.1
ββ numba 0.60.0
ββ nibabel 5.2.1
ββ nilearn 0.10.4
ββ dipy 1.9.0
ββ openmeeg 2.5.6
ββ pandas 2.2.2
ββ h5io 0.2.4
ββ h5py 3.9.0
ββ unavailable cupy
Visualization (optional)
ββ pyvista 0.44.1 (OpenGL 3.3 (Core Profile) Mesa 21.2.5 via softpipe)
ββ pyvistaqt 0.11.1
ββ vtk 9.2.6
ββ qtpy 2.4.1 (None=None)
ββ pyqtgraph 0.13.7
ββ mne-qt-browser 0.6.3
ββ ipywidgets 8.1.3
ββ trame_client 3.2.1
ββ trame_server 3.0.3
ββ trame_vtk 2.8.9
ββ trame_vuetify 2.6.2
ββ unavailable ipympl
Ecosystem (optional)
ββ eeglabio 0.0.2-4
ββ edfio 0.4.3
ββ mffpy 0.9.0
ββ pybv 0.7.5
ββ unavailable mne-bids, mne-nirs, mne-features, mne-connectivity, mne-icalabel, mne-bids-pipeline, neo
How can I set it up? I donβt find many more info on the internet