Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kernel keeps dying in jupyter notebook

Whenever I start jupyter notebook and create a new python 3 notebook I get an error message saying kernel has died. I have tried deleting and installing ipython, python3.6.5, and jupyter notebook but I still get the error message.

My cmd screen is as follows:-

[I 06:46:36.432 NotebookApp] KernelRestarter: restarting kernel (4/5), new random ports
WARNING:root:kernel 0d0442a9-c92f-46e6-acdd-08ca0a18c5f2 restarted
Traceback (most recent call last):

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    from IPython.core.profiledir import ProfileDir

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\IPython\__init__.py", line 55, in <module>
    from .terminal.embed import embed

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\IPython\terminal\embed.py", line 17, in <module>
    from IPython.terminal.ipapp import load_default_config

  File "c:\users\user\appdata\local\programs\python\python36-32\lib\site-packages\IPython\terminal\ipapp.py", line 34, in <module>
    from IPython.extensions.storemagic import StoreMagics

**ModuleNotFoundError: No module named 'IPython.extensions'**

[W 06:46:39.450 NotebookApp] KernelRestarter: restart failed

[W 06:46:39.450 NotebookApp] Kernel 0d0442a9-c92f-46e6-acdd-08ca0a18c5f2 died, removing from map.

ERROR:root:kernel 0d0442a9-c92f-46e6-acdd-08ca0a18c5f2 restarted failed!
[W 06:46:39.461 NotebookApp] 410 DELETE /api/sessions/67987236-8755-433a-afcb-e052ccbf65b9 (::1): Kernel deleted before session

**[W 06:46:39.461 NotebookApp] Kernel deleted before session**

[W 06:46:39.461 NotebookApp] 410 DELETE /api/sessions/67987236-8755-433a-afcb-e052ccbf65b9 (::1) 1.00ms 

referer=http://localhost:8888/notebooks/Untitled5.ipynb?kernel_name=python3## Heading ##
like image 697
Subrat Katiyar Avatar asked Jun 10 '18 16:06

Subrat Katiyar


People also ask

Why is the kernel dying in Jupyter Notebook?

A kernel error occurs basically when you try opening a python 3 file in the wrong directory. The truth is Jupyter and Python are two different software entirely. So, a kernel error occurs when Jupyter fails to connect with a specific version of Python.

How do you resolve a dead kernel in Jupyter Notebook?

You can also go to "File" > "Close and Halt" within Jupyter if you still have the notebook open on your screen. Once you've closed the other notebooks, you can restart your dead kernel by going to "Kernel" > "Restart" within Jupyter.

What does restarting the kernel do in Jupyter Notebook?

Jupyter Lesson 10: How to reset the Kernel (Clear all in memory objects and stop the code) If the notebook or your code is acting weird sometimes it is best to press the “RESET BUTTON”. Reseting the kernel clears all in memory objects and restarts your code from the very top.


2 Answers

Determining why jupyter notebook kernel dies can be daunting sometimes. When kernel dies as a result of library issues, you might not get any feedback as to what is causing it. Try running the code that is causing the kernel to die in a terminal or in ipython. One common issue I have identified is the use of SSE4.1 in later versions of tensorflow, which gives this error: TensorFlow library was compiled to use SSE4.1 instructions, but these aren't available on your machine. Aborted (core dumped). This will cause the kernel to die if you are using tensorflow in your code and not display any error in notebook. If this is the case, uninstall tensorflow and install with conda: conda install tensorflow==1.12.0, for instance.

like image 138
fijo Avatar answered Oct 26 '22 22:10

fijo


Not the exact same issue as yours, but I found my kernel kept dying when I used the

exit()

command in one of my class methods. Removing this exit() command stopped my kernel from dying.

like image 32
kidbilly Avatar answered Oct 26 '22 21:10

kidbilly