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