GUI and display [not working as intended]

Hello everyone,

I am having issues with the gui function and show_view, following the ecog tutorial in MNE’s webpage.

First of all, MNE and OS versions are:

- MNE version: e.g. 0.24.1
- operating system: Ubuntu 24

The functions are:

mne.gui.locate_ieeg
show_view

The issue is not regarding errors caught, but that for both functions, the window only displays for less than a second, where in the case of the GUI, the window displays but it is all black.

Does anyone have any idea why or had similar issues?

Much appreciated

Hmmm sounds like an issue with mne.viz.Brain which is the 3D brain renderer that uses pyvista. Can you share the output of running mne sys_info in a terminal? This may also be solved by running pip install -U pyvista pyvistaqt.

Also, try run the code in the terminal using

python -i main.py

main.py should be the name of your script.
Or run the code in the Jupyter notebook.
Pycharm’s Python console did not work for me, too.

1 Like

Hello,

I do have pyvistaqt, as can be seen running the command as asked of you:


Platform:       Linux-5.13.0-27-generic-x86_64-with-glibc2.31
Python:         3.9.9 | packaged by conda-forge | (main, Dec 20 2021, 02:41:03)  [GCC 9.4.0]
Executable:     /home/beyond/.conda/envs/Ecog_EEG_MEG/bin/python3.9
CPU:            x86_64: 12 cores
Memory:         23.3 GB

mne:            0.24.1
numpy:          1.22.0 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy:          1.7.3
matplotlib:     3.5.1 {backend=QtAgg}

sklearn:        1.0.2
numba:          0.53.1
nibabel:        3.2.1
nilearn:        0.8.1
dipy:           1.4.1
cupy:           Not found
pandas:         1.3.5
mayavi:         4.7.2
pyvista:        0.33.2 {OpenGL 4.5.0 NVIDIA 460.91.03 via GeForce RTX 2070 Super/PCIe/SSE2}
pyvistaqt:      0.7.0
ipyvtklink:     Not found
vtk:            9.0.3
PyQt5:          5.12.3
ipympl:         Not found
mne_qt_browser: 0.1.7
pooch:          v1.5.2

If it is indeed pyvistaqt, could it be a problem of my graphics card?

Hello,

Thank you Barry, I will try that and report back

Hi again,

Through the terminal it did not work aswell, the last output at the terminal before exit is:

Using pyvistaqt 3d backend.

What did you type in the terminal?
The computer is PC or a server/cluster?

1 Like

This is what I typed:

source activate conda_env_X
python -i main.py

It is my own PC

My Terminal output in case you are wandering:

place/lib/python3.9/site-packages/nilearn/datasets/__init__.py:93: FutureWarning: Fetchers from the nilearn.datasets module will be updated in version 0.9 to return python strings instead of bytes and Pandas dataframes instead of Numpy arrays.
  warn("Fetchers from the nilearn.datasets module will be "
place/main.py:17: RuntimeWarning:   Could not parse meas date from the header. Setting to None.
  raw = mne.io.read_raw_cnt('ecog_place/FResende/sEEG_tasksMemoryEmotionsNPS18122015/sEEG_FR_almoco.cnt')
Using normal I/O
    Creating tag directory for /place/python3.9/site-packages/mne/data/fsaverage/fsaverage-fiducials.fif...
start { 0
    start { 107
        block = 107 nent = 4 nchild = 0
    end } 107
    block = 0 nent = 4 nchild = 1
end } 0
[done]
Reading FreeSurfer talairach.xfm file:
/ecog_place/FResende/MRI_CT/fsaverage/subject/mri/transforms/talairach.xfm
Found: 'MNI Transform File'
Loading /ecog_place/FResende/MRI_CT/fsaverage/subject/mri/brain.mgz
Using pyvistaqt 3d backend.

THE END MY FRIEND
Traceback (most recent call last):
  File "/place/main.py", line 29, in <module>
    exit()
  File "/place/python3.9/_sitebuiltins.py", line 26, in __call__
    raise SystemExit(code)
SystemExit: None

Sorry, I’m not sure about the problem.
Any ideas? @alexrockhill

1 Like

Me neither… You think it could be somewhat related to pyvistaqt?

I have it loaded, but it is not working as intended, neither through the terminal

Try the notebook before figuring it out.

1 Like

Doing it now. Will report in a couple mins

With Jupyter notebook the outcome is totally different yet similar.

Similar because the gui window appeared for a second all black, then closed.

Different because it displayed a message noting the Kernel died and it will restart, plus an attribute error:

AttributeError: 'IPythonKernel' object has no attribute 'app'

Any ideas?

Okay I figured it out, but could not do it without Barry’s help.

So it basically can only run in a Jupyter notebook, BUT, it cannot run if it either has the following:

>>> gui.close()
>>> exit()

If either of these are present after, the gui will never run.

Thank you Barry! (Once again)

1 Like

Can you run it in a terminal without gui.close()?

You can try the following operations:
(1) Make sure mesa is installed on your ubuntu:

sudo apt update && sudo apt upgrade -y
sudo apt install mesa-utils -y
glxinfo | grep "OpenGL version"

## Install/Upgrade Mesa Drivers – oibaf/graphics-drivers
sudo add-apt-repository ppa:oibaf/graphics-drivers -y
sudo apt update
sudo apt upgrade -y
glxinfo | grep "OpenGL version"

(2)Check the soft link " libstdc++.so.6" and the target file"libstdc++.so.6.0.30" (My system has libstdc++.so.6.0.30 in that folder, yours may be libstdc++.so.6.0.29 or 28)is the same (name and size) in both paths “/lib/x86_64-linux-gnu” and " /path to your anaconda/anaconda3/lib"

cd /lib/x86_64-linux-gnu
ls -al | grep libstdc++

cd /home/xxx/anaconda3/lib (I installed the anaconda here)
ls -al | grep libstdc++

If the above files are not the same in both paths:

(a)Delete the soft link “libstdc++.so, libstdc++.so.6” and target file “libstdc++.so.6.0.X” in the path “/home/xxx/anaconda3/lib”
(b)copy the target file “libstdc++.so.6.0.X” from “/lib/x86_64-linux-gnu” to " /home/xxx/anaconda3/lib":

sudo cp /lib/x86_64-linux-gnu/libstdc++.so.6.0.X  /home/xxx/anaconda3/lib

Create the soft links "libstdc++.so " and “libstdc++.so.6” for "libstdc++.so.6.0.X ":

  ln -s libstdc++.so.6.0.X libstdc++.so 
  ln -s libstdc++.so.6.0.X libstdc++.so.6

(3) Set up mne

mne.viz.set_3d_backend("pyvistaqt")
mne.viz.set_3d_options(antialias=False) 

False is useful when renderers have problems (such as software MESA renderers).