question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Kernel appears to have crashed with mne.viz

See original GitHub issue

MNE version 0.22.1 Python version 3.8.5 Remote jupyter notebook/google colab

Describe the bug

I have been trying to run several of the jupyter tutorials from the mne website in a remote jupyter notebook. Each time I try to run any command that uses mne.viz(), or any other interactive visualization, the kernel restarts and I get the message “the kernel appears to have died”

Steps to Reproduce

For example, I get the “kernel appears to have died” message when I run the following code:

%matplotlib inline

import mne
Brain = mne.viz.get_brain_class()

subjects_dir = mne.datasets.sample.data_path() + '/subjects'
mne.datasets.fetch_hcp_mmp_parcellation(subjects_dir=subjects_dir,
                                        verbose=True)

mne.datasets.fetch_aparc_sub_parcellation(subjects_dir=subjects_dir,
                                          verbose=True)

labels = mne.read_labels_from_annot(
    'fsaverage', 'HCPMMP1', 'lh', subjects_dir=subjects_dir)

brain = Brain('fsaverage', 'lh', 'inflated', subjects_dir=subjects_dir,
              cortex='low_contrast', background='white', size=(800, 600))

In particular, the kernel crashes on the last line, when there is a call to mne.viz.get_brain_class()

Is there a workaround (maybe specific to remote jupyter notebooks) to stop this crash from happening?

Additional information I have tried running the same code in Google colab as well, which also results in the same problem. I have also tried running other tutorials, which similarly crash whenever I try to run any of the mne.viz() functions

Platform: Remote jupyter notebook (in CoCalc), have also tried in Google Colab Python: 3.8.5 Executable: C:\Users\yxie\Anaconda3\python.exe CPU: Intel® Xeon® CPU Model 85 Stepping 7 Memory: 32887760 kB

mne: 0.22.1 numpy: 1.19.5 {blas=D:\a\1\s\numpy\build\openblas_info, lapack=D:\a\1\s\numpy\build\openblas_lapack_info} scipy: 1.5.0 matplotlib: 3.2.2 {backend=module://ipykernel.pylab.backend_inline}

sklearn: 0.0 numba: 0.51.2 nibabel: 3.1.0 nilearn: 0.6.2 dipy: Not found cupy: Not found pandas: 1.2.3 mayavi: Not found pyvista: 0.29.1 vtk: 9.0.1

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
GuillaumeFaveliercommented, Apr 22, 2021

As a side note, Google Colab is not yet supported with this backend, you can follow the progress on this in the following thread:

https://github.com/mne-tools/mne-python/issues/8704#issue-781224584.

0reactions
leosunpsycommented, Nov 21, 2022

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).

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's new — MNE 1.2.2 documentation
Fix bug that appears during automatic calculation of the colormap of mne.viz.Brain when data values of fmin and fmax are too close (#10074 ......
Read more >
The kernel appears to have died. It will restart automatically ...
Apologies for the audio distortion in the beginning of the video: I am a robot.In this video, I'll show you how to fix...
Read more >
GUI and display [not working as intended] - MNE Forum
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...
Read more >
Jupyter | The kernel appears to have died. It will restart ...
In my case, the error was caused due to an issue with hdf5(Version mismatch) library which suggests that whenver kernel dies unexpectedly any ......
Read more >
Display GridSpace of QuadMesh objects - HoloViews
Hello, I'm trying to make a Gridspace filled with Quadmesh objects, but every time I try to display it, my runtime crashes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found