New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jupyter kernal keeps dying #1892

Closed
jslug1000 opened this Issue Nov 14, 2016 · 16 comments

Comments

Projects
None yet
@jslug1000

jslug1000 commented Nov 14, 2016

Hi,

When opening any jupyter notebook, even one with no code in, I get the 'Dead kernal' message:

The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted. If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work until the notebook is reopened.

My terminal window shows the following:

[I 07:56:47.888 NotebookApp] [nb_conda_kernels] enabled, 1 kernels found
[I 07:56:48.230 NotebookApp] The port 8888 is already in use, trying another port.
[I 07:56:48.438 NotebookApp] [nb_anacondacloud] enabled
[I 07:56:48.456 NotebookApp] [nb_conda] enabled
[I 07:56:48.874 NotebookApp] ✓ nbpresent HTML export ENABLED
[W 07:56:48.874 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named 'nbbrowserpdf'
[I 07:56:48.886 NotebookApp] Serving notebooks from local directory: /Users/jedgecombe
[I 07:56:48.886 NotebookApp] 0 active kernels
[I 07:56:48.886 NotebookApp] The Jupyter Notebook is running at: http://localhost:8889/
[I 07:56:48.887 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 07:57:08.143 NotebookApp] Notebook Dropbox/Python/AB_testing/template/ab_test_template.ipynb is not trusted
[I 07:57:08.694 NotebookApp] Kernel started: 8743e528-acb5-488f-8e46-456675500373
[W 07:57:08.723 NotebookApp] 404 GET /kernelspecs/Python%20[Root]/logo-64x64.png (::1) 25.64ms referer=http://localhost:8889/notebooks/Dropbox/Python/AB_testing/template/ab_test_template.ipynb
Traceback (most recent call last):
File "/Users/jedgecombe/anaconda3/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "/Users/jedgecombe/anaconda3/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/jedgecombe/anaconda3/lib/python3.5/site-packages/ipykernel/main.py", line 2, in
from ipykernel import kernelapp as app
File "/Users/jedgecombe/anaconda3/lib/python3.5/site-packages/ipykernel/kernelapp.py", line 98, in
ConnectionFileMixin):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
[I 07:57:11.695 NotebookApp] KernelRestarter: restarting kernel (1/5)
Traceback (most recent call last):
File "/Users/jedgecombe/anaconda3/lib/python3.5/runpy.py", line 184, in _run_module_as_main
"main", mod_spec)
File "/Users/jedgecombe/anaconda3/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/jedgecombe/anaconda3/lib/python3.5/site-packages/ipykernel/main.py", line 2, in
from ipykernel import kernelapp as app
File "/Users/jedgecombe/anaconda3/lib/python3.5/site-packages/ipykernel/kernelapp.py", line 98, in
ConnectionFileMixin):
TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

It tries to restart 5 times (so some repeated code from above) then shows the following:

[W 07:57:23.735 NotebookApp] KernelRestarter: restart failed
[W 07:57:23.735 NotebookApp] Kernel 8743e528-acb5-488f-8e46-456675500373 died, removing from map.
ERROR:root:kernel 8743e528-acb5-488f-8e46-456675500373 restarted failed!
[W 07:57:23.757 NotebookApp] Kernel deleted before session
[W 07:57:23.757 NotebookApp] 410 DELETE /api/sessions/d129aa7e-fc50-4cfd-9e5d-aab57ff7b49e (::1) 1.74ms referer=http://localhost:8889/notebooks/Dropbox/Python/AB_testing/template/ab_test_template.ipynb

I've tried pip uninstalling and re-installing, also tried this with conda but no luck and can't see similar problems online. Would be extremely grateful for any help!

@takluyver

This comment has been minimized.

Member

takluyver commented Nov 14, 2016

Can you try uninstalling all of:

  • ipykernel
  • ipython
  • jupyter_client
  • jupyter_core
  • traitlets
  • ipython_genutils

And then install again. If you're doing this inside a conda env, it might be easiest to create a new environment and start from scratch. Also, if you're going to install with conda, run conda clean -tipsy to clean up conda caches before you start.

@jslug1000

This comment has been minimized.

jslug1000 commented Nov 14, 2016

fixed it! Thank you so much - I've been searching for hours for an answer! Really appreciate it.

@takluyver

This comment has been minimized.

Member

takluyver commented Nov 14, 2016

You're welcome. For the record, my guess is that it was incompatible versions of some of those packages being installed. It probably wasn't necessary to reinstall them all, but it's easier to do that than try to work it out more closely.

@takluyver takluyver closed this Nov 14, 2016

@minrk minrk added this to the no action milestone Nov 23, 2016

@sainttelant

This comment has been minimized.

sainttelant commented Sep 29, 2017

thanks so much, i 've tried several solutions, but didn't work until i found uninstall ipykernel, and reinstalled it, it worked,thanks.

@jonnyhtw

This comment has been minimized.

jonnyhtw commented Jan 25, 2018

Brilliant, worked straight away.

Cheers

Jonny

@DanEran1988

This comment has been minimized.

DanEran1988 commented Mar 16, 2018

I am trying to work with jupyter notebook, but when I open a file I receive the following error:

The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted. If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work until the notebook is reopened.

In the CMD I see the following:

(base) C:\Users\Dan Eran>jupyter notebook [W 19:05:33.006 NotebookApp] Error loading server extension jupyterlab Traceback (most recent call last): File "C:\Users\Dan Eran\AppData\Roaming\Python\Python36\site-packages\notebook\notebookapp.py", line 1451, in init_server_extensions mod = importlib.import_module(modulename) File "C:\Anaconda3\lib\importlib__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 953, in _find_and_load_unlocked ModuleNotFoundError: No module named 'jupyterlab' [I 19:05:33.122 NotebookApp] Serving notebooks from local directory: C:\Users\Dan Eran [I 19:05:33.122 NotebookApp] 0 active kernels [I 19:05:33.122 NotebookApp] The Jupyter Notebook is running at: [I 19:05:33.122 NotebookApp] http://localhost:8888/?token=99a355c23c6617857e387f53d0af607ae26b89c20598336e [I 19:05:33.122 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 19:05:33.122 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=99a355c23c6617857e387f53d0af607ae26b89c20598336e
[I 19:05:33.247 NotebookApp] Accepting one-time-token-authenticated connection from ::1 [I 19:05:42.699 NotebookApp] Creating new notebook in [I 19:05:43.563 NotebookApp] Kernel started: 1433cbbf-f4b9-4dd3-be19-e91d7ee3d82f Traceback (most recent call last): File "C:\Anaconda3\lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "C:\Anaconda3\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "C:\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app File "C:\Anaconda3\lib\site-packages\ipykernel__init.py", line 2, in from .connect import * File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in from IPython.core.profiledir import ProfileDir ModuleNotFoundError: No module named 'IPython' [I 19:05:46.555 NotebookApp] KernelRestarter: restarting kernel (1/5), new random ports Traceback (most recent call last): File "C:\Anaconda3\lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "C:\Anaconda3\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "C:\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app File "C:\Anaconda3\lib\site-packages\ipykernel__init.py", line 2, in from .connect import * File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in from IPython.core.profiledir import ProfileDir ModuleNotFoundError: No module named 'IPython' [I 19:05:49.591 NotebookApp] KernelRestarter: restarting kernel (2/5), new random ports Traceback (most recent call last): File "C:\Anaconda3\lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "C:\Anaconda3\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "C:\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app File "C:\Anaconda3\lib\site-packages\ipykernel__init.py", line 2, in from .connect import * File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in from IPython.core.profiledir import ProfileDir ModuleNotFoundError: No module named 'IPython' [I 19:05:52.620 NotebookApp] KernelRestarter: restarting kernel (3/5), new random ports Traceback (most recent call last): File "C:\Anaconda3\lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "C:\Anaconda3\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "C:\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app File "C:\Anaconda3\lib\site-packages\ipykernel__init.py", line 2, in from .connect import * File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in from IPython.core.profiledir import ProfileDir ModuleNotFoundError: No module named 'IPython' [W 19:05:53.595 NotebookApp] Timeout waiting for kernel_info reply from 1433cbbf-f4b9-4dd3-be19-e91d7ee3d82f [I 19:05:55.632 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports WARNING:root:kernel 1433cbbf-f4b9-4dd3-be19-e91d7ee3d82f restarted Traceback (most recent call last): File "C:\Anaconda3\lib\runpy.py", line 193, in run_module_as_main "main", mod_spec) File "C:\Anaconda3\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "C:\Anaconda3\lib\site-packages\ipykernel_launcher.py", line 15, in from ipykernel import kernelapp as app File "C:\Anaconda3\lib\site-packages\ipykernel__init.py", line 2, in from .connect import * File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in from IPython.core.profiledir import ProfileDir ModuleNotFoundError: No module named 'IPython' [W 19:05:58.671 NotebookApp] KernelRestarter: restart failed [W 19:05:58.671 NotebookApp] Kernel 1433cbbf-f4b9-4dd3-be19-e91d7ee3d82f died, removing from map. ERROR:root:kernel 1433cbbf-f4b9-4dd3-be19-e91d7ee3d82f restarted failed! [W 19:05:58.705 NotebookApp] 410 DELETE /api/sessions/fd456273-adb3-48cd-92f8-d531c9b8f7a8 (::1): Kernel deleted before session [W 19:05:58.709 NotebookApp] Kernel deleted before session [W 19:05:58.709 NotebookApp] 410 DELETE /api/sessions/fd456273-adb3-48cd-92f8-d531c9b8f7a8 (::1) 4.00ms referer=http://localhost:8888/notebooks/Untitled11.ipynb?kernel_name=python3

I have tried to uninstall and then reinstall the modules you've mentioned. However, I was not able to solve the problem. any ideas? THANKS!!

@ShixiangWang

This comment has been minimized.

ShixiangWang commented Mar 19, 2018

I can not fix this problem 😢

@paulmattheww

This comment has been minimized.

paulmattheww commented Apr 8, 2018

It must be a keras specific issue, tensorflow alone works fine on my machine but keras keeps crashing it.

@alvi-subhan

This comment has been minimized.

alvi-subhan commented May 10, 2018

screenshot from 2018-05-10 18-39-53
i am having this issue whenever i try to run keras or tensorflow it keeps crashing while its working perfectly with other libraries.

@gunjannaik

This comment has been minimized.

gunjannaik commented May 30, 2018

Remove the ipykernel using conda remove ipykernel
and then resinstall with lower version with pip install ipykernel ==4.2.2

Worked for me.

@alvi-subhan

This comment has been minimized.

alvi-subhan commented Jun 12, 2018

@fazzalll

This comment has been minimized.

fazzalll commented Jun 21, 2018

if anyone facing the issue regarding .. kernel failure

it may be probably due to ipython failure

you can fix it by reinstalling ipython and its dependencies on your machine
$ pip install ipython[all]
you can see kernel working properly in jupyter

it worked for me

@thetrailblazer4

This comment has been minimized.

thetrailblazer4 commented Aug 18, 2018

if you're using anaconda then run this in anaconda prompt "conda clean -tipsy" then conda install the package. for e.g. if you're working with Numpy package, then run conda install numpy

@Sakshi2018

This comment has been minimized.

Sakshi2018 commented Sep 26, 2018

In my case, When I tried running the cells, they were working fine untill reached to the training cell, where the kernel showed an error:

image

@Sakshi2018

This comment has been minimized.

Sakshi2018 commented Sep 26, 2018

However, the jupyter notebook looks like:
image
Any help will be greatly appreciated

@park-moonkyu

This comment has been minimized.

park-moonkyu commented Oct 30, 2018

thanks a lot.
i have a problem about dead kernel
but it solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment