Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter notebook - Dead Kernel

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 "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", 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 <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    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 <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    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 <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    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 <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    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 <module>
    from ipykernel import kernelapp as app
  File "C:\Anaconda3\lib\site-packages\ipykernel\__init__.py", line 2, in <module>
    from .connect import *
  File "C:\Anaconda3\lib\site-packages\ipykernel\connect.py", line 13, in <module>
    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 some modules. However, I was not able to solve the problem. any ideas? THANKS!!

like image 969
Dan Eran Avatar asked Mar 16 '18 17:03

Dan Eran


People also ask

What does it mean when the kernel dies in Jupyter Notebook?

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.

Are Jupyter notebooks deprecated?

Starts the Jupyter notebook server in your home directory. This tool is closed source.


2 Answers

It seems like there is something wrong with the jupyter installation. I recommend upgrading anaconda to v5, which should install jupyter by default(not sure if that is the case for v3, which is what seems to be used in this case). Try installing the missing modules using conda install if you want to stick with conda v3.

conda install -c conda-forge jupyterlab
conda install -c anaconda ipython

IPython, Jupyterlab

like image 117
ninjrok Avatar answered Oct 31 '22 07:10

ninjrok


I got the same error. Its because we haven't given administrator privilege. You have to install anaconda using administrator. Or run the app as administrator. Just right click on jupyter or spyder then select run as administrator. Or while installing anaconda select install as administrator

like image 1
Navneeth Avatar answered Oct 31 '22 09:10

Navneeth