Skip to content
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 Notebook Could not Connect to Kernel upon Start #7135

Closed
SmoltingAmber opened this issue Oct 30, 2023 · 1 comment
Closed

Jupyter Notebook Could not Connect to Kernel upon Start #7135

SmoltingAmber opened this issue Oct 30, 2023 · 1 comment
Labels
bug status:Needs Triage Applied to issues that need triage

Comments

@SmoltingAmber
Copy link

@kevin-bates

Jupyter notebook can't connect to kernel as i get: "A connection to the notebook server could not be established. The notebook will continue trying to reconnect. Check your network connection or notebook server configuration. " error message.

Things i've tried:

  • reinstall python (newest version)
  • reinstall anaconda (newest version)
  • reinstall tornado as version 5.1.1
    I don't think it's a firewall issue as I'm working at home and it worked just a few days ago.

Detailed the error messages and descriptions described below:[I 10:13:33.456 NotebookApp] Serving notebooks from local directory: C:\Users\arena
[I 10:13:33.456 NotebookApp] Jupyter Notebook 6.5.4 is running at:
[I 10:13:33.456 NotebookApp] http://localhost:8888/?token=c5a68051d3d81fc964448454cd0310f81f5b4366ed6bd5ad
[I 10:13:33.456 NotebookApp] or http://127.0.0.1:8888/?token=c5a68051d3d81fc964448454cd0310f81f5b4366ed6bd5ad
[I 10:13:33.456 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 10:13:33.476 NotebookApp]

To access the notebook, open this file in a browser:
file:///C:/Users/arena/AppData/Roaming/jupyter/runtime/nbserver-7316-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=c5a68051d3d81fc964448454cd0310f81f5b4366ed6bd5ad
or http://127.0.0.1:8888/?token=c5a68051d3d81fc964448454cd0310f81f5b4366ed6bd5ad
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[I 10:13:37.684 NotebookApp] Creating new notebook in
Bad address (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
[W 10:13:39.111 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20231030101332 (::1) 20.260000ms referer=http://localhost:8888/notebooks/Untitled11.ipynb?kernel_name=my_env
[I 10:13:39.117 NotebookApp] Kernel started: 38983398-bb22-4527-a438-6703c9caef6e, name: my_env
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Bad address (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
Bad address (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
[IPKernelApp] WARNING | Parent appears to have exited, shutting down.

Searched extensively through threads here and Jupyter notebook stackoverflow threads and tried every suggestion I could found that has worked for someone in both places, but nothing has worked so far.

After removing the environment I created following one of the suggestions given on stackoverflow, using "jupyter kernelspec uninstall my_env", when I attempted to launch jupyter notebook form command line again, I got these different error messages:

[W 11:42:24.708 NotebookApp] Loading JupyterLab as a classic notebook (v6) extension.
[I 2023-10-30 11:42:24.718 LabApp] JupyterLab extension loaded from C:\Users\arena\anaconda3\Lib\site-packages\jupyterlab
[I 2023-10-30 11:42:24.719 LabApp] JupyterLab application directory is C:\Users\arena\anaconda3\share\jupyter\lab
[I 11:42:26.388 NotebookApp] Serving notebooks from local directory: C:\Users\arena
[I 11:42:26.389 NotebookApp] Jupyter Notebook 6.5.4 is running at:
[I 11:42:26.389 NotebookApp] http://localhost:8888/?token=cbd196e87cc8774ac3658cb2246c322911b8e11c895f9f10
[I 11:42:26.389 NotebookApp] or http://127.0.0.1:8888/?token=cbd196e87cc8774ac3658cb2246c322911b8e11c895f9f10
[I 11:42:26.389 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:42:26.418 NotebookApp]

To access the notebook, open this file in a browser:
    file:///C:/Users/arena/AppData/Roaming/jupyter/runtime/nbserver-1836-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/?token=cbd196e87cc8774ac3658cb2246c322911b8e11c895f9f10
 or http://127.0.0.1:8888/?token=cbd196e87cc8774ac3658cb2246c322911b8e11c895f9f10

0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
[I 11:42:32.590 NotebookApp] Creating new notebook in
Bad address (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
[I 11:42:34.876 NotebookApp] Kernel started: 5894b3d1-7185-4445-b150-14740c19d257, name: python3
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Bad address (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
Exception in thread IOPub:
Bad address (C:\ci\zeromq_1616055400030\work\src\epoll.cpp:100)
Traceback (most recent call last):
File "C:\Users\arena\anaconda3\Lib\threading.py", line 1038, in _bootstrap_inner
self.run()
File "C:\Users\arena\anaconda3\Lib\threading.py", line 975, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\arena\anaconda3\Lib\site-packages\ipykernel\iostream.py", line 85, in _thread_main
self.io_loop.run_sync(_start_event_gc)
File "C:\Users\arena\anaconda3\Lib\site-packages\tornado\ioloop.py", line 521, in run_sync
self.start()
File "C:\Users\arena\anaconda3\Lib\site-packages\tornado\platform\asyncio.py", line 195, in start
self.asyncio_loop.run_forever()
File "C:\Users\arena\anaconda3\Lib\asyncio\base_events.py", line 607, in run_forever
self._run_once()
File "C:\Users\arena\anaconda3\Lib\asyncio\base_events.py", line 1884, in _run_once
event_list = self._selector.select(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\arena\anaconda3\Lib\selectors.py", line 323, in select
r, w, _ = self._select(self._readers, self._writers, [], timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\arena\anaconda3\Lib\selectors.py", line 314, in _select
r, w, x = select.select(r, w, w, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 10038] An operation was attempted on something that is not a socket
[IPKernelApp] WARNING | Parent appears to have exited, shutting down.

Hope someone here could help me and suggest what I can try next... Thanks in advance!

Trying to launch it from command line resulted in the following log:

@SmoltingAmber SmoltingAmber added bug status:Needs Triage Applied to issues that need triage labels Oct 30, 2023
@SmoltingAmber
Copy link
Author

The problem is solved by referring to this thread:

Jupyter Notebook | Bad address (C:\projects\libzmq\src\epoll.cpp:100)

thanks to the suggestion of a friend :)

The root cause appeared to be I have used my VPN in stealth mode and it has changed my winsocket setting. The solution is a command line run of

netsh winsock reset

Though the symptom was Jupyter notebook not able to connect to python kernel, the tell tale error message apparently was the "bad address" ones.

I am posting this just in case anyone in the future have the same problem...

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug status:Needs Triage Applied to issues that need triage
Projects
None yet
Development

No branches or pull requests

1 participant