notebook: Jupyter Notebook Kernel Not Connecting: Connection Failed

With Regards,

I have installed Anaconda and then launch Jupyter Notebook .Being a noob I am trying printing my name in it I am not getting the ouput.

I have downgraded the tornado to 5.1.1, but still it is not working. I have Python 3.7.1 installed.

There is something ipykernel which I have installed by using pip install ipykernel but again nothing happens.

Moreover on typing jupyter kernelspec list I ve got this C:\Users\This-PC>jupyter kernelspec list Available kernels: python3 c:\users\this-pc\appdata\local\programs\python\python37-32\share\jupyter\kernels\python3

I am attaching some images please find out. If you need anything else I will supply it.

Thank you.

Errors: Error

Not connecting

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 87 (28 by maintainers)

Most upvoted comments

If it can help @kevin-bates - I ran into similar issues as above, and eventually got to @fedeturi’s error.

What happened the original issue was caused by using pip in a conda environment to install some unrelated package (google.colab), which then messed up the jupyter installation (with some different versions of six, tornado, ipython, notebook, ipykernel).

This caused errors similar to the others in the thread above.

Installing and uninstalling jupyter got me to the same issue as @fedeturi.

Eventually what fixed it for me was to:

  • remove manually all the above packages with pip uninstall
  • remove also jupyter_contrib_nbextensions
  • running a conda uninstall jupyter notebook

and then re-installing jupyter and jupyter_contrib_nbextensions with conda.

Hello, I ran into the same problem today. Just like @kevin-bates mentioned. You should always look for the prerequisite packages and upgrade them (or uninstall all of them and install notebook to grab the best version matching.

For current release notebook-6.0.3

ipykernel-5.3.0 ipython-7.15.0 jupyter-client-6.1.3 jupyter-core-4.6.3 tornado-6.0.4

Hope it helps

@toanasahmed - this is the output on the Notebook itself. I’m talking about the terminal/shell in which the command jupyter notebook was invoked. It should contain some traceback information or the like relative to this issue.

I would also recommend restarting the notebook server with debug logging enabled (e.g., jupyter notebook --debug ... which will produce additional information that may prove helpful. Thanks.

@toanasahmed - we’re actually going backwards here from a troubleshooting standpoint, so let’s try to address the issues I see in your response and we’ll go from there.

  1. The debug flag uses two dashes and no space between the second dash and the string ‘debug’. It is literally --debug. The ellipses (e.g., ...) were purely meant to represent the rest of your command line when jupyter notebook was started the first time. They should not be included in your command and is why jupyter produced its help output because it couldn’t parse those options. If you don’t know how your jupyter server was started originally, then it may not be possible to continue this exercise unless your original command was simply jupyter notebook.
  2. From the screen shot of your server console, I see you probably have two previous instances of jupyter server running. The first is using port 8888, the second is using port 8889 and the final (current) instance is listening on port 8890. I would strongly recommend you terminate all instances so that only one is running (with the --debug flag). To terminate instances, go to their command window/terminal and enter <control-C> twice. This will terminate a single instance of a server. If you no longer have access to those terminals, you’ll need to determine the notebook process and terminate it.
  3. Once you start a jupyter server with debug enabled, you’ll need to attempt to use a kernel. Its that attempted use of the kernel that should produce more information on the terminal window in which you started the server. Its that information that is desired. From your output above, I just see an instance (likely the third instance) of notebook server started successfully, but because you didn’t attempt to start a kernel, I can’t help with the original issue.

Once the these three points are addressed I think we should be able to move forward on troubleshooting your original issue. Thanks.

Hello!

I am struggling with the same problem, checked many different solutions on the internet, tried them all, even uninstalling Anaconda and reinstalling, and it does not seem to work with any of these solutions.

This is what I get from the console.

` (base) C:\Users\PC02>jupyter-notebook [I 17:49:22.201 NotebookApp] Serving notebooks from local directory: C:\Users\PC02 [I 17:49:22.201 NotebookApp] 0 active kernels [I 17:49:22.201 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=4d3c5cdfbe05ead068f3b18bc6a4248effd952f5fe74050d [I 17:49:22.201 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 17:49:22.278 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
    http://localhost:8888/?token=4d3c5cdfbe05ead068f3b18bc6a4248effd952f5fe74050d

[I 17:49:22.528 NotebookApp] Accepting one-time-token-authenticated connection from ::1 [W 17:49:27.165 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20200702174921 (::1) 16.95ms referer=http://localhost:8888/notebooks/Untitled.ipynb [I 17:49:27.426 NotebookApp] Kernel started: 64e1f1ca-8f10-4995-8170-a8a3f56d0847 C:\Users\PC02\AppData\Roaming\Python\Python37\site-packages\notebook\base\zmqhandlers.py:292: RuntimeWarning: coroutine ‘WebSocketHandler.get’ was never awaited super(AuthenticatedZMQStreamHandler, self).get(*args, **kwargs) RuntimeWarning: Enable tracemalloc to get the object allocation traceback [W 17:49:29.466 NotebookApp] Replacing stale connection: 64e1f1ca-8f10-4995-8170-a8a3f56d0847:D9F2455DAFA4402381AC2B5512679652 `

It was working yesterday, and apparently stopped after installing PyCharm, what seems wired.

This is mi office workstation so I am stucked and would appreciate the help.

for me it was a stupid thing , I closed the terminal that I wrote “jupyter notebook” in it

had some problem on ubuntu pip install tornado==5.1.1 (after this you need restart jupyter notebook with jupyter notebook helped me / 15th July 2020

Thanks Bro, This was a big help…struggling since a week.

😄 I believe “interesting portions” of the terminal output have scrolled off your screen. Please capture the entire startup sequence, either via screen-scrape or by redirecting the output to a file.

What we can see is that it appears the kernel-info response has not been received. This is consistent with the kernel not completely starting. I’m hoping some “useful” information is above the various GET responses. There should be information pertaining to the kernel’s startup.