Spyder: Reports of Kernel Death are greatly exagerated

Created on 22 Sep 2016  Â·  46Comments  Â·  Source: spyder-ide/spyder

Description of your problem

What steps will reproduce the problem?

  1. launch a new Ipython console
  2. during a few seconds, "kernel death" messages are displayed
    kernel_death_20160922
  3. all is going back in order without human intervention, but for 4 Kernel death message there are 4 "[1]" lines displayed in the new Ipython console
    kernel_death_20160922b

What is the expected output? What do you see instead?

  • no, or much less reports of "Kernel Death"

Please provide any additional information below

  • it's more frequent if the pc is slow or busy

Versions and main components

  • Spyder Version:3.0.0-master of 2016-09-21 ("b8")
  • Python Version: any (3.4)
  • Operating system: Windows 10

    Dependencies

Please go to the menu entry Help > Optional Dependencies (or
Help > Dependencies), press the button Copy to clipboard
and paste the contents below:
jedi >=0.8.1 : 0.9.0 (OK)
matplotlib >=1.0 : 2.0.0b4 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.11.1 (OK)
pandas >=0.13.1 : 0.19.0rc1 (OK)
pep8 >=0.6 : 1.7.0 (OK)
pyflakes >=0.6.0 : 1.3.0 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.6.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4-1 (OK)
sphinx >=0.6.6 : 1.4.6 (OK)
sympy >=0.7.3 : 1.0 (OK)

IPython Console Bug

Most helpful comment

Not serious? It renders Spyder unusable. I'd say that is serious. After several minutes, "Kernel died, restarting" returns.

What's interesting, is that I was using Spyder last night without a problem. Now today, this problem manifests. For both 3.0.0 and 3.0.1.

All 46 comments

I have the same on 64bit Linux (Mint 18)

Spyder 3.0.0b7 installed via conda
Python 2.7.12 |Anaconda 4.1.1 (64-bit)| (default, Jul 2 2016, 17:42:40)
IPython 4.2.0 -- An enhanced Interactive Python.
jedi >=0.8.1 : 0.9.0 (OK)
matplotlib >=1.0 : 1.5.1 (OK)
nbconvert >=4.0 : 4.2.0 (OK)
numpy >=1.7 : 1.11.1 (OK)
pandas >=0.13.1 : 0.18.1 (OK)
pep8 >=0.6 : 1.7.0 (OK)
psutil >=0.3 : 4.3.0 (OK)
pyflakes >=0.5.0 : 1.2.3 (OK)
pygments >=2.0 : 2.1.3 (OK)
pylint >=0.25 : 1.5.4 (OK)
qtconsole >=4.2.0: 4.2.1 (OK)
rope >=0.9.4 : 0.9.4 (OK)
sphinx >=0.6.6 : 1.4.1 (OK)
sympy >=0.7.3 : 1.0 (OK)

Atleast in my case spyder 3.0.0.b6 doesn't have this issue, but spyder 3.0.0b7 and spyder 3.0 both do.

yes, the big architectural change (on the connexion to ipython kernel) was merged after b6. https://github.com/spyder-ide/spyder/pull/2878

@ccordoba12 Hello everybody, im getting the same exact error. Happy to help. My understanding is that error is not very serious, right?

Yes, it isn't serious. We just need to find a way to prevent it :-)

Not serious? It renders Spyder unusable. I'd say that is serious. After several minutes, "Kernel died, restarting" returns.

What's interesting, is that I was using Spyder last night without a problem. Now today, this problem manifests. For both 3.0.0 and 3.0.1.

Actually, noticed an issue with distnoted process (runaway cpu usage) https://discussions.apple.com/thread/7290687?start=0&tstart=0 which may be related.
I rebooted and "kernel died, restarting" issue did not manifest...because of distnoted? or because I rebooted? Don't know yet. I'll respond with more info when/if this occurs again.

It is serious, I can't debug any program and the solution that you give, does not work to me. Another idea? Thanks

This is not Spyder's fault. This happens when your computer is slow to create a kernel (because it lacks enough RAM or it's undergoing high CPU usage, as @mrclary said before).

@ccordoba12 maybe if the time to generated de kernel was long as the time in the defauld configuration the error will fix

Yep, the idea to solve this issue is to increase the time to check the kernel is up.

But this can't be made infinitely large :-) I think 6 secs is good enough (from the current 3 secs).

Please when we chance this time. I try to find this time in spyder_kernel.py but it didn't appear

Maybe the loading of spyder itself is also slowing down things (time to load in windows cache all python objects).

would it be possible to start (or start waiting) the kernel thing after the rest of spyder is well loaded ?

@ccordoba12 say somethig about time of wait for kernel of ipython. I think that the problem is on ipython console and not in spyder. I have the problem and i back to spyder 2.3.9 becouse 3.0 and 3.01 have this problem.

Here are some logs:

P500:~/Downloads$ spyder
Qt: Cannot set locale modifiers: 
void DBusMenuExporterPrivate::addAction(QAction*, int): Already tracking action "Project explorer" under id 124 
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/spyder/utils/ipython/start_kernel.py", line 223, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/spyder/utils/ipython/start_kernel.py", line 196, in main
    from ipykernel.kernelapp import IPKernelApp
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/__init__.py", line 2, in <module>
    from .connect import *
  File "/usr/local/lib/python2.7/dist-packages/ipykernel/connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir
  File "/home/lukeskywalker/.local/lib/python2.7/site-packages/IPython/__init__.py", line 48, in <module>
    from .core.application import Application
  File "/home/lukeskywalker/.local/lib/python2.7/site-packages/IPython/core/application.py", line 25, in <module>
    from IPython.core import release, crashhandler
  File "/home/lukeskywalker/.local/lib/python2.7/site-packages/IPython/core/crashhandler.py", line 28, in <module>
    from IPython.core import ultratb
  File "/home/lukeskywalker/.local/lib/python2.7/site-packages/IPython/core/ultratb.py", line 128, in <module>
    from IPython.utils.terminal import get_terminal_size
  File "/home/lukeskywalker/.local/lib/python2.7/site-packages/IPython/utils/terminal.py", line 22, in <module>
    from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size
ImportError: No module named shutil_get_terminal_size

@livst, this is not the same error as the one reported here. For your problem, please see https://github.com/ipython/ipython/issues/9656

I have v3.5 installed on my Mac (2.2 GHz Intel Core i7; 16 GB RAM; OS X 10.11.6) and I am still seeing this issue. I found the ipythonconsole.py file and the time to detect if a kernel is alive was already set to 6 seconds. The problem doesn't seem to fix itself after a number of restarts (I count like 15 right now) and my total CPU usage currently is about 6%. I don't know if there is something with Mac OS that I need to do differently?

What time is long enough for you?

I have not increased the time yet. Is there a time that you recommend that I try first? I am not sure what range would be reasonable.

Why don't you use a bisection approach? You could try 12 secs first, and if that's not enough then 24, or if that's good enough then 9, etc.

Great thank you :) Also sorry, I am new to all of this. Is it enough to just edit the .py file itself and save it on my computer? I changed the value to 12, then 24, then 48. It doesn't seem to change the time before the error text 'Kernel died, restarting' appears.

After every change you need to restart Spyder. Did you do that?

I did restart Spyder after every change.

This is the current time in code:
kernel_client.hb_channel.time_to_dead = 48.0

Should I keep doubling it? Or at this point would it be something else that is causing the issue?

Yours has to be a different problem then.

I just installed Spyder yesterday using Anaconda:
conda update qt pyqt
conda update spyder

There didn't seem to be any issues with installing any of the packages. But the ipython kernel had the issue from the moment I first opened Spyder.

But IPython consoles eventually start for you or not?

El 04/12/16 a las 13:49, reedetb escribió:
>

I just installed Spyder yesterday using Anaconda:
conda update qt pyqt
conda update spyder

There didn't seem to be any issues with installing any of the
packages. But the ipython kernel had the issue from the moment I first
opened Spyder.

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/spyder-ide/spyder/issues/3444#issuecomment-264722366,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAWS7TvofukTJ_vtmgLlR8CFAfis0Swfks5rEwtGgaJpZM4KEI0Q.

No, they don't ever start.

That's a different problem :-)

Please start Spyder from a terminal and print here the errors you're seeing there. If IPython consoles are not starting there has to be some errors preventing it.

Haha I see! This is what I get when I start it:

Timothys-MacBook-Pro:~ treeder$ ipython
Python 3.5.2 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:52:12)
Type "copyright", "credits" or "license" for more information.

IPython 4.2.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]:

FWIW, my problems with unexpectedly dead kernel messages stopped after I upgraded to the most recent Anaconda - this included a Jupyter/ipython upgrade - so perhaps ots an ipython 4.2 vs ipython 5.1 issue?

I think I already have the most recent Anaconda (4.2.13?). But I did just now upgrade my version of ipython from 4.2.0-py35_1 --> 5.1.0-py35_1.

Again, it works in the terminal but is not working in spyder:

Python 3.5.2 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:52:12)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]:

I also ran these two lines and saw that the package requirements were already met:
pip install -U qtconsole
pip install -U jupyter

Just a note, the python console works in Spyder, just the ipython console is having issues. I have my firewall turned off and my antivirus program disabled.

Thanks for your help guys! It is working when I open spyder from the terminal.

Still having this issue on Windows, although I have not tried to run Spyder from terminal.

Following message, I am getting after running the given code for Deep MNIST for experts at, https://www.tensorflow.org/get_started/mnist/pros
Running on Spyder 3.1.4 and python 3.5

step 19300, training accuracy 1
step 19400, training accuracy 1
step 19500, training accuracy 1
step 19600, training accuracy 1
step 19700, training accuracy 1
step 19800, training accuracy 1
step 19900, training accuracy 1

Kernel died, restarting

Kernel died, restarting

Kernel died, restarting

@mukeshholani, your error could be caused by lack of memory in your system. I don't see a relation between it and this issue (because this one only happens when a console is instantiated).

@ccordoba12 doesn't seems like problem with memroy.
I also tried with training of only 200 iterations.
still kernel is died in the below statement.

print("test accuracy %g"%accuracy.eval(feed_dict={
x: mnist.test.images, y_: mnist.test.labels, keep_prob: 1.0}))

Solved, the issue was not there, it was my bug. Can say memory issue. because declared the same variable before with less dimensions.

Spyder 3.2.0, IPython 5.3.0, Anaconda on 64 bit Windows 7.
I was getting the "kernel died" messages in the IPython console window when starting Spyder. Sometimes many of them. IPython console starts fine outside of Spyder.
Found the ipythonconsole.py file in ...\AppData\Local\Continuum\Anaconda2\pkgs\spyder-3.2.0-py27_0\Lib\site-packages\spyder\plugins\
Edited line # 1391: "kernel_client.hb_channel.time_to_dead = 6.0", changed timeout to 20 seconds and this stopped the "kernel died" messages.

Thanks @AldoMaine, we'll consider this for our next release.

Thanks. When I rebooted this morning and started Spyder I got one or two of the annoying kernel is dead messages. So on my work PC, 20 seconds isn't always enough. I suspect available RAM and other processes are slowing down the IPython launch on this machine. I never have this issue on my home PC. Bottom line, most users will probably be fine with 6 seconds but a handful of us will want to extend this timeout setting.

I had the same issue, I originally installed Spyder using Conda, I uninstalled " conda uninstall spyder". Then, reinstalled it using pip " pip install spyder" worked fine for me .

Then, reinstalled it using pip " pip install spyder" worked fine for me .

That's really bad! We warn against this everywhere we can (please don't recommend it again).

I had this problem as well. I fixed it with: "conda uninstall spyder" + "conda install spyder"

Ran into a similar problem. Tried "Reset Spyder to factory defaults" and it solved my problem.

I met this problem yesterday, and I didn't meet this problem a week ago on the same code with a few changes.
I didn't find the ipythonconsole.py to change the time.
What can I do?

here is what the console shows:
Python 3.8.3 (default, Jul 2 2020, 17:30:36) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.19.0 -- An enhanced Interactive Python.

Restarting kernel...

[SpyderKernelApp] WARNING | No such comm: 720c4990248d11ebb8eb9061aea980c0

Mandatory:

atomicwrites >=1.2.0 : 1.4.0 (OK)
chardet >=2.0.0 : 3.0.4 (OK)
cloudpickle >=0.5.0 : 1.6.0 (OK)
diff_match_patch >=20181111 : 20200713 (OK)
intervaltree : None (OK)
IPython >=4.0 : 7.19.0 (OK)
jedi =0.17.1 : 0.17.1 (OK)
nbconvert >=4.0 : 6.0.7 (OK)
numpydoc >=0.6.0 : 1.1.0 (OK)
paramiko >=2.4.0 : 2.7.2 (OK)
parso =0.7.0 : 0.7.0 (OK)
pexpect >=4.4.0 : 4.8.0 (OK)
pickleshare >=0.4 : 0.7.5 (OK)
psutil >=5.3 : 5.7.2 (OK)
pygments >=2.0 : 2.7.2 (OK)
pylint >=1.0 : 2.6.0 (OK)
pyls >=0.34.0;<1.0.0 : 0.35.1 (OK)
qdarkstyle >=2.8 : 2.8.1 (OK)
qtawesome >=0.5.7 : 1.0.1 (OK)
qtconsole >=4.6.0 : 4.7.7 (OK)
qtpy >=1.5.0 : 1.9.0 (OK)
rtree >=0.8.3 : 0.9.4 (OK)
sphinx >=0.6.6 : 3.2.1 (OK)
spyder_kernels >=1.9.4;<1.10.0 : 1.9.4 (OK)
watchdog : None (OK)
zmq >=17 : 19.0.2 (OK)

Optional:

cython >=0.21 : None (OK)
matplotlib >=2.0.0 : 3.3.2 (OK)
numpy >=1.7 : 1.19.2 (OK)
pandas >=0.13.1 : 1.1.3 (OK)
scipy >=0.17.0 : 1.5.2 (OK)
sympy >=0.7.3 : None (OK)

Was this page helpful?
0 / 5 - 0 ratings