raw.plot(block=True) freezes the jupyter kernel forever
See original GitHub issueDescribe the bug
When plotting continuous “raw” data and specify block=True
, everything works well until you try to close the figure. Control is never handed back to the command line. This does not occur when using command line ipython, but does occur when using Spyder or a Jupyter notebook.
Steps and/or code to reproduce
In Spyder or a notebook:
import mne
data_path = mne.datasets.sample.data_path()
raw = mne.io.read_raw_fif(data_path +'/MEG/sample/sample_audvis_raw.fif')
raw.plot(block=True)
Close the plotting window. The Jupyer kernel now hangs.
Expected results
After closing the window, the Jupyter kernel should become responsive again.
Actual results
Jupyter kernel never becomes responsive.
Additional information
Platform: Linux-4.4.0-148-generic-x86_64-with-debian-stretch-sid
Python: 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) [GCC 7.3.0]
Executable: /work/modules/Ubuntu/14.04/amd64/common/anaconda3/latest/envs/neuroimaging/bin/python
CPU: x86_64: 8 cores
Memory: 15.6 GB
mne: 0.18.1 (also tested this on current master)
numpy: 1.16.4 {blas=mkl_rt, lapack=mkl_rt}
scipy: 1.2.1
matplotlib: 3.1.0 {backend=Qt5Agg}
sklearn: 0.21.2
nibabel: 2.4.1
mayavi: 4.6.2 {qt_api=pyqt5, PyQt5=5.9.2}
cupy: Not found
pandas: 0.24.2
dipy: Not found
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (7 by maintainers)
Top Results From Across the Web
Jupyter Notebook + Matplotlib; Freeze on plot.show()
Is this in Jupyter Notebook or something of the sort? Usually you shouldn't be able to do matplotlib.use('QT4Agg') import matplotlib.
Read more >How to Fix Kernel Error in Jupyter Notebook
When the system encounters difficulties locating the path which certain programs will run, this error is known as a kernel error in Jupyter ......
Read more >Rendering Jupyter notebooks with inline plots freezes ... - GitLab
Create a Jupyter notebook with an inline plot and commit it to a GitLab ... plots, the CPU usage goes up causing the...
Read more >Jupyter Notebook 6.5.2 documentation - Read the Docs
The execution behavior of a cell is determined by the cell's type. There are three types of cells: code cells, markdown cells, and...
Read more >Plotly - notebook / Very slow render with many graphs
Is this a plotly thing or a jupyter notebook thing or a mix of both? ... seems to freeze up and with 15+...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This still breaks for me in Spyder, but not in plain
ipython
or in a notebook:However, @mvonflotow’s suggestion of disabling Spyder’s active support did the trick. I’m guessing there’s some weird interaction between the Qt thread spawned by the
QtConsole
component that Spyder uses and theblock=True
behavior. I’ll file the issue there.I cannot reproduce the issue, the minimal example does not block execution in both a regular Jupyter notebook and inside VS Code. Maybe you do not have the latest versions of the involved packages (i.e. Matplotlib, Jupyter)?