Jupyter Notebook: Timeout waiting for kernel_info_reply

12,950

My problem was solved by uninstalling anaconda, after which I downloaded and installed the latest anaconda version.

I believe that my anti-virus caused the problem with the initial installation of the older Anaconda version, by blocking some of the installation and/or configuration settings. My conclusion is based on the fact that a whole lot of warning messages from Kaspersky kept popping up, asking whether to allow or to block the paths that the application wants to take to open up and run.

Choosing the "allow" button each time lead to Jupyter working fine.

Share:
12,950
Johan Espach
Author by

Johan Espach

Updated on June 19, 2022

Comments

  • Johan Espach
    Johan Espach almost 2 years

    When I try to run my code in Jupyter Notebook, nothing happens. The cells don't respond. Here is a screenshot of what happens (or rather, doesn't happen) when I try running the cells.

    Jupyter notebook showing code not running

    I have tried clicking on the "Restart & Run All" option under the Kernel tab. It only gives me a warning message that the Kernel has died:

    Image showing dead kernel message

    If I click on the "Try restarting now" button on the warning message, the message goes away, but the code still won't run. However, if I just leave the notebook for quite some time (I think it took as long as an hour), the code does eventually run and the notebook operates as it should.

    The problems that I've typed in are easy one-liners, such as print (2 + 2), or import numpy as np as is shown in the first screenshot, but the lines don't get executed.

    I am running Python 3.5 on the notebook, that is opened using Anaconda Navigator. Furthermore, my operating system is Windows 10.

    I have tried uninstalling and re-installing Anaconda (both the Python 3 and Python 2 versions) and turning off my anti-virus, but nothing seems to solve the problem.

    Does anyone have an idea why this is happening and how it can be fixed? Any help will be much appreciated!

    The terminal message is as follows:

    [I 12:43:00.890 NotebookApp] Serving notebooks from local directory: C:\Users\Essi
    [I 12:43:00.891 NotebookApp] 0 active kernels
    [I 12:43:00.891 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
    [I 12:43:00.891 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
    [I 12:43:26.635 NotebookApp] Kernel started: 7612964e-692c-430c-99ba-b0ed2190f12c
    [W 12:43:36.822 NotebookApp] Timeout waiting for kernel_info reply from 7612964e-692c-430c-99ba-b0ed2190f12c
    [I 12:43:55.421 NotebookApp] Kernel restarted: 7612964e-692c-430c-99ba-b0ed2190f12c
    [I 12:44:15.437 NotebookApp] Kernel restarted: 7612964e-692c-430c-99ba-b0ed2190f12c
    [W 12:44:25.425 NotebookApp] Timeout waiting for kernel_info_reply: 7612964e-692c-430c-99ba-b0ed2190f12c
    [E 12:44:25.427 NotebookApp] Exception restarting kernel
        Traceback (most recent call last):
          File "C:\Users\Essi\Anaconda3\lib\site-packages\notebook\services\kernels\handlers.py", line 88, in post
            yield gen.maybe_future(km.restart_kernel(kernel_id))
          File "C:\Users\Essi\Anaconda3\lib\site-packages\tornado\gen.py", line 1008, in run
            value = future.result()
          File "C:\Users\Essi\Anaconda3\lib\site-packages\tornado\concurrent.py", line 232, in result
            raise_exc_info(self._exc_info)
          File "<string>", line 3, in raise_exc_info
        tornado.gen.TimeoutError: Timeout waiting for restart
    [E 12:44:25.507 NotebookApp] {
          "Referer": "http://localhost:8888/notebooks/Documents/Vac%20Work%20progs/123.ipynb",
          "Accept": "application/json, text/javascript, */*; q=0.01",
          "Host": "localhost:8888",
          "Content-Length": "0",
          "Accept-Encoding": "gzip, deflate",
          "Connection": "keep-alive",
          "X-Requested-With": "XMLHttpRequest",
          "Accept-Language": "en-US,en;q=0.5",
          "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
        }
    [E 12:44:25.508 NotebookApp] 500 POST /api/kernels/7612964e-692c-430c-99ba-b0ed2190f12c/restart (::1) 31148.06ms referer=http://localhost:8888/notebooks/Documents/Vac%20Work%20progs/123.ipynb
    [I 12:44:26.615 NotebookApp] Kernel shutdown: 7612964e-692c-430c-99ba-b0ed2190f12c
    [W 12:44:27.626 NotebookApp] Session not found: session_id='8d2aafbc-0bc6-47b8-9648-6c3650d07513'
    [W 12:44:27.627 NotebookApp] 404 DELETE /api/sessions/8d2aafbc-0bc6-47b8-9648-6c3650d07513 (::1) 2.00ms referer=http://localhost:8888/notebooks/Documents/Vac%20Work%20progs/123.ipynb
    [I 12:44:27.677 NotebookApp] Kernel started: e5487dea-ffa3-4498-9238-c70df3c58963
    [W 12:44:37.717 NotebookApp] Timeout waiting for kernel_info reply from e5487dea-ffa3-4498-9238-c70df3c58963
    [W 12:44:45.448 NotebookApp] Timeout waiting for kernel_info_reply: 7612964e-692c-430c-99ba-b0ed2190f12c
    [E 12:44:45.448 NotebookApp] Exception restarting kernel
        Traceback (most recent call last):
          File "C:\Users\Essi\Anaconda3\lib\site-packages\notebook\services\kernels\handlers.py", line 88, in post
            yield gen.maybe_future(km.restart_kernel(kernel_id))
          File "C:\Users\Essi\Anaconda3\lib\site-packages\tornado\gen.py", line 1008, in run
            value = future.result()
          File "C:\Users\Essi\Anaconda3\lib\site-packages\tornado\concurrent.py", line 232, in result
            raise_exc_info(self._exc_info)
          File "<string>", line 3, in raise_exc_info
        tornado.gen.TimeoutError: Timeout waiting for restart
    [E 12:44:45.450 NotebookApp] {
          "Referer": "http://localhost:8888/notebooks/Documents/Vac%20Work%20progs/123.ipynb",
          "Accept": "application/json, text/javascript, */*; q=0.01",
          "Host": "localhost:8888",
          "Content-Length": "0",
          "Accept-Encoding": "gzip, deflate",
          "Connection": "keep-alive",
          "X-Requested-With": "XMLHttpRequest",
          "Accept-Language": "en-US,en;q=0.5",
          "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
        }
    [E 12:44:45.451 NotebookApp] 500 POST /api/kernels/7612964e-692c-430c-99ba-b0ed2190f12c/restart (::1) 31061.81ms referer=http://localhost:8888/notebooks/Documents/Vac%20Work%20progs/123.ipynb
    [I 12:44:47.055 NotebookApp] Kernel shutdown: e5487dea-ffa3-4498-9238-c70df3c58963
                                          [I 12:45:26.611 NotebookApp] Saving file at /Documents/Vac Work progs/123.ipynb
                                                       [W 12:51:54.702 NotebookApp] Session not found: session_id='3fef32b0-5580-4ea5-b61e-9fe5b3892368'
    [W 12:51:54.703 NotebookApp] 404 DELETE /api/sessions/3fef32b0-5580-4ea5-b61e-9fe5b3892368 (::1) 1.02ms referer=http://localhost:8888/notebooks/Documents/Vac%20Work%20progs/123.ipynb
    [I 12:51:54.784 NotebookApp] Kernel started: ceb9046d-94e3-467b-96a3-e8f49bcfbb87
                                           [W 12:52:04.824 NotebookApp] Timeout waiting for kernel_info reply from ceb9046d-94e3-467b-96a3-e8f49bcfbb87
    

    Things that I have further tried, include turning off just the firewall, turning off the blockers in my browser and trying to run jupyter in Chrome and Edge. I have also tried pip install -U jsonschema, after which I get the following response:

    C:\Users\Essi>pip install -U jsonschema
    Could not fetch URL https://pypi.python.org/simple/jsonschema/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645) - skipping
    Requirement already up-to-date: jsonschema in c:\users\essi\anaconda3\lib\site-packages
    

    None of the aforementioned actions have helped. Is the certificate verify failed response causing another problem?

    I am able to open an Ipython session (I hope you are referring to the black screen in which code can be executed). However, the Ipython console in Spyder has the same problem as in Jupyter,, but I am able to bypass this problem by configuring the "run" action to "Execute in a new dedicated console".