Jupyter notebook cannot connect to kernel

My Jupyter notebooks suddenly cannot to the kernel. The notebook and the kernel are on the same machine. I have tried restarting the computer and uninstalling and reinstalling Anaconda, but it does not solve the problem.

I have used Anaconda and Jupyter notebooks for several years, and it has always worked before.

I’m using Anaconda 2023.03 on Windows.

Here is the output I get in the console window:

[W 13:16:28.800 NotebookApp] Loading JupyterLab as a classic notebook (v6) extension.
[W 2023-04-17 13:16:28.800 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[W 2023-04-17 13:16:28.800 LabApp] 'notebook_dir' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release.
[I 2023-04-17 13:16:28.816 LabApp] JupyterLab extension loaded from C:\Users\qlujora\AppData\Local\anaconda3\lib\site-packages\jupyterlab
[I 2023-04-17 13:16:28.816 LabApp] JupyterLab application directory is C:\Users\qlujora\AppData\Local\anaconda3\share\jupyter\lab
2023-04-17 13:16:29,417 WARNING: panel.io.resources - Mimetype declaration for .js files was set to 'text/plain'. This will interefere with serving JS modules. Ensure your system does not override the mimetype declaration and/or contact your system administrator.
[I 13:16:29.887 NotebookApp] The port 8888 is already in use, trying another port.
[I 13:16:29.887 NotebookApp] Serving notebooks from local directory: C:\Users\qlujora
[I 13:16:29.887 NotebookApp] Jupyter Notebook 6.5.2 is running at:
[I 13:16:29.887 NotebookApp] http://localhost:8889/?token=0303cafb7f44b8a8899258463e7c8407e092af7eed4e9e82
[I 13:16:29.887 NotebookApp]  or http://127.0.0.1:8889/?token=0303cafb7f44b8a8899258463e7c8407e092af7eed4e9e82
[I 13:16:29.887 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 13:16:29.918 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/qlujora/AppData/Roaming/jupyter/runtime/nbserver-22500-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/?token=0303cafb7f44b8a8899258463e7c8407e092af7eed4e9e82
     or http://127.0.0.1:8889/?token=0303cafb7f44b8a8899258463e7c8407e092af7eed4e9e82
[I 13:16:47.913 NotebookApp] Kernel started: 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9, name: python3
Exception in thread IOPub:
Traceback (most recent call last):
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\site-packages\ipykernel\iostream.py", line 75, in _thread_main
    self.io_loop.start()
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\site-packages\tornado\platform\asyncio.py", line 199, in start
    self.asyncio_loop.run_forever()
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\asyncio\base_events.py", line 1868, in _run_once
    event_list = self._selector.select(timeout)
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\selectors.py", line 324, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\selectors.py", line 315, in _select
    r, w, x = select.select(r, w, w, timeout)
TypeError: select() takes 2 positional arguments but 4 were given
Traceback (most recent call last):
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\site-packages\ipykernel_launcher.py", line 17, in <module>
    app.launch_new_instance()
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\site-packages\traitlets\config\application.py", line 992, in launch_instance
    app.start()
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\site-packages\ipykernel\kernelapp.py", line 698, in start
    self.kernel.start()
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\site-packages\ipykernel\ipkernel.py", line 212, in start
    super().start()
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\site-packages\ipykernel\kernelbase.py", line 550, in start
    asyncio.run_coroutine_threadsafe(self.poll_control_queue(), control_loop.asyncio_loop)
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\asyncio\tasks.py", line 892, in run_coroutine_threadsafe
    loop.call_soon_threadsafe(callback)
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\asyncio\base_events.py", line 798, in call_soon_threadsafe
    self._check_closed()
  File "C:\Users\qlujora\AppData\Local\anaconda3\lib\asyncio\base_events.py", line 515, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
IOStream.flush timed out
[W 13:17:08.939 NotebookApp] Replacing stale connection: 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922
[W 13:17:30.983 NotebookApp] Replacing stale connection: 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922
[W 13:17:47.943 NotebookApp] Timeout waiting for kernel_info reply from 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[I 13:17:47.945 NotebookApp] Starting buffering for 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922
[I 13:17:47.945 NotebookApp] Restoring connection for 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922
[W 13:17:52.509 NotebookApp] Nudge: attempt 10 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:17:57.550 NotebookApp] Nudge: attempt 20 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:18:02.616 NotebookApp] Nudge: attempt 30 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:18:07.672 NotebookApp] Nudge: attempt 40 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:18:12.746 NotebookApp] Nudge: attempt 50 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:18:17.819 NotebookApp] Nudge: attempt 60 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:18:22.884 NotebookApp] Nudge: attempt 70 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:18:27.981 NotebookApp] Nudge: attempt 80 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:18:33.071 NotebookApp] Nudge: attempt 90 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:18:38.142 NotebookApp] Nudge: attempt 100 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[W 13:18:43.208 NotebookApp] Nudge: attempt 110 on kernel 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9
[E 13:18:47.961 NotebookApp] Uncaught exception GET /api/kernels/7606f1ad-ec0c-4dee-86fc-a06f2979f8e9/channels?session_id=16fe9da33ac9404287ea6e766d2a0922 (127.0.0.1)
    HTTPServerRequest(protocol='http', host='localhost:8889', method='GET', uri='/api/kernels/7606f1ad-ec0c-4dee-86fc-a06f2979f8e9/channels?session_id=16fe9da33ac9404287ea6e766d2a0922', version='HTTP/1.1', remote_ip='127.0.0.1')
    Traceback (most recent call last):
      File "C:\Users\qlujora\AppData\Local\anaconda3\lib\site-packages\tornado\websocket.py", line 956, in _accept_connection
        await open_result
      File "C:\Users\qlujora\AppData\Local\anaconda3\lib\asyncio\tasks.py", line 304, in __wakeup
        future.result()
    tornado.util.TimeoutError: Timeout
[W 13:18:48.977 NotebookApp] Replacing stale connection: 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922
[W 13:19:11.006 NotebookApp] Replacing stale connection: 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922
[W 13:19:35.021 NotebookApp] Replacing stale connection: 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922
[W 13:20:03.042 NotebookApp] Replacing stale connection: 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922
[W 13:20:39.054 NotebookApp] Replacing stale connection: 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922
[W 13:21:31.082 NotebookApp] Replacing stale connection: 7606f1ad-ec0c-4dee-86fc-a06f2979f8e9:16fe9da33ac9404287ea6e766d2a0922

1 Like