vscode-jupyter: Kernel won't start due to connection timeout
Environment data
- VS Code version: 1.83.1
- Jupyter Extension version (available under the Extensions sidebar): v2023.9.1102792234
- Python Extension version (available under the Extensions sidebar): v2023.18.0
- OS (Windows | Mac | Linux distro) and version: Mac (Intel)
- Python and/or Anaconda version: 3.11.6
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
- Jupyter server running: Local | Remote | N/A
Expected behaviour
When I close the notebook, or choose Restart Kernel, the kernal restarts and I can run cells again.
Actual behaviour
It gets stuck on interrupting the kernel. Closing the file, and quittting vscode both do not fix the issue. The first cell I try to run remains stuck on pending. The only work around I could figure out was turning the running cell into markdown, running a different cell, and then turning the first cell back to code before running again. Talk about a headache.
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
- Open notebook where first cell is stuck on pending
- Try to run cell -> Nothing happens
- Try to restart kernel -> gets stuck
- Try to close and reopen file -> still stuck
- Try to quit VSCode and reopen file -> still stuck
Logs
Output for Jupyter
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Jupyter
)
Visual Studio Code (1.83.1, undefined, desktop)
Jupyter Extension Version: 2023.9.1102792234.
Python Extension Version: 2023.18.0.
Platform: darwin (x64).
Multiple Workspace folders opened ~/F1, ~/F2
16:27:16.723 [info] User belongs to experiment group 'NewJupyterSession'
16:27:18.346 [info] Start refreshing Kernel Picker (1697527638346)
16:27:18.350 [info] Not using Pylance
16:27:18.732 [info] Start refreshing Interpreter Kernel Picker
16:27:22.017 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd0aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49./usr/local/bin/python3./usr/local/bin/python3.-m#ipykernel_launcher (Python Path: /usr/local/bin/python3, Unknown, 3.11.6) for '~/xxx.ipynb' (disableUI=true)
16:27:24.789 [info] Registering dummy command feature
16:27:28.591 [warn] Failed to get activated env vars for /usr/local/bin/python3 in 10053ms
16:27:28.596 [info] Process Execution: /usr/local/bin/python3 -c "import site;print("USER_BASE_VALUE");print(site.USER_BASE);print("USER_BASE_VALUE");"
16:27:28.673 [warn] Failed to get activated env vars for /usr/local/bin/python3 in 6383ms
16:27:28.822 [info] Process Execution: /usr/local/bin/python3 -m pip list
16:27:28.826 [info] Process Execution: /usr/local/bin/python3 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
16:27:28.830 [info] Process Execution: /usr/local/bin/python3 -m ipykernel_launcher --ip=127.0.0.1 --stdin=9003 --control=9001 --hb=9000 --Session.signature_scheme="hmac-sha256" --Session.key=b"1821fd21-0e34-455d-819b-807556cff7e2" --shell=9002 --transport="tcp" --iopub=9004 --f=~/Library/Jupyter/runtime/kernel-v2-7605PWguFGT2ShOw.json
> cwd: ~/analysis
16:27:31.583 [info] ipykernel version & path 6.20.2, ~/Library/Python/3.11/lib/python/site-packages/ipykernel/__init__.py for /usr/local/bin/python3
16:27:31.584 [info] End refreshing Kernel Picker (1697527638346)
16:27:34.135 [error] Error: Message Decoding: Incorrect;
Obtained "0ce2a2a270976420f883cd5fb1081f8941f9d4685f701006472b0f1d28a47c9b"
Expected "6cb5fc10aacde47c33e7210a8dc53cf6f447c8efa7acc9a4bad7e7dc43a387eb"
at Object.t.Jx (~/.vscode/extensions/ms-toolsai.jupyter-2023.9.1102792234-darwin-x64/out/extension.node.js:2:315668)
at WebSocket.onIncomingMessage (~/.vscode/extensions/ms-toolsai.jupyter-2023.9.1102792234-darwin-x64/out/extension.node.js:24:104652)
at WebSocket.processSocketMessages (~/.vscode/extensions/ms-toolsai.jupyter-2023.9.1102792234-darwin-x64/out/extension.node.js:24:103996)
16:27:35.187 [warn] StdErr from Kernel Process 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.
16:27:35.796 [warn] StdErr from Kernel Process Traceback (most recent call last):
16:27:35.796 [warn] StdErr from Kernel Process File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "~/Library/Python/3.11/lib/python/site-packages/ipykernel_launcher.py", line 17, in <module>
app.launch_new_instance()
File "~/Library/Python/3.11/lib/python/site-packages/traitlets/config/application.py", line 1040, in launch_instance
app.initialize(argv)
File "~/Library/Python/3.11/lib/python/site-packages/traitlets/config/application.py", line 113, in inner
return method(app, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/Library/Python/3.11/lib/python/site-packages/ipykernel/kernelapp.py", line 677, in initialize
self.init_sockets()
File "~/Library/Python/3.11/lib/python/site-packages/ipykernel/kernelapp.py", line 316, in init_sockets
self.shell_port = self._bind_socket(self.shell_socket, self.shell_port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/Library/Python/3.11/lib/python/site-packages/ipykernel/kernelapp.py", line 251, in _bind_socket
return self._try_bind_socket(s, port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/Library/Python/3.11/lib/python/site-packages/ipykernel/kernelapp.py", line 227, in _try_bind_socket
s.bind("tcp://%s:%i" % (self.ip, port))
16:27:35.797 [warn] StdErr from Kernel Process File "~/Library/Python/3.11/lib/python/site-packages/zmq/sugar/socket.py", line 300, in bind
super().bind(addr)
File "zmq/backend/cython/socket.pyx", line 564, in zmq.backend.cython.socket.Socket.bind
File "zmq/backend/cython/checkrc.pxd", line 28, in zmq.backend.cython.checkrc._check_rc
zmq.error.ZMQError: Address already in use
16:27:36.773 [error] Disposing session as kernel process died ExitCode: 1, Reason: zmq.error.ZMQError
16:27:36.773 [info] Dispose Kernel process 8395.
16:27:36.909 [warn] Didn't get response for requestKernelInfo after 3001ms.
16:27:51.733 [info] Handle Execution of Cells 0 for ~/xx.ipynb
16:30:44.695 [info] Handle Execution of Cells 0 for ~/xx.ipynb
16:34:31.537 [info] Handle Execution of Cells 0 for Untitled-1.ipynb
16:34:31.549 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd0aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49./usr/local/bin/python3./usr/local/bin/python3.-m#ipykernel_launcher (Python Path: /usr/local/bin/python3, Unknown, 3.11.6) for 'Untitled-1.ipynb' (disableUI=false)
16:34:31.596 [warn] Failed to get activated env vars for /usr/local/bin/python3 in 43ms
16:34:31.598 [info] Process Execution: /usr/local/bin/python3 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
16:34:31.599 [info] Process Execution: /usr/local/bin/python3 -m ipykernel_launcher --ip=127.0.0.1 --stdin=9013 --control=9006 --hb=9005 --Session.signature_scheme="hmac-sha256" --Session.key=b"30e9c416-ad5f-4b3b-a17c-9021e2ed3c56" --shell=9007 --transport="tcp" --iopub=9014 --f=~/Library/Jupyter/runtime/kernel-v2-76058aUlAjY8BjZr.json
> cwd: ~/F1
16:34:31.611 [warn] Failed to get activated env vars for /usr/local/bin/python3 in 47ms
16:34:31.613 [info] Process Execution: /usr/local/bin/python3 -m pip list
16:34:31.869 [info] ipykernel version & path 6.20.2, ~/Library/Python/3.11/lib/python/site-packages/ipykernel/__init__.py for /usr/local/bin/python3
16:34:32.146 [warn] StdErr from Kernel Process 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.
16:34:32.509 [info] Process Execution: /usr/local/bin/python3 ~/.vscode/extensions/ms-toolsai.jupyter-2023.9.1102792234-darwin-x64/pythonFiles/printJupyterDataDir.py
16:34:32.519 [info] Kernel acknowledged execution of cell 0 @ 1697528072518
16:34:32.524 [info] End cell 0 execution @ 1697528072524, started @ 1697528072518, elapsed time = 0.006s
16:34:43.530 [info] Handle Execution of Cells 0 for Untitled-1.ipynb
16:34:43.537 [info] Kernel acknowledged execution of cell 0 @ 1697528083537
16:34:43.540 [info] End cell 0 execution @ 1697528083540, started @ 1697528083537, elapsed time = 0.003s
16:35:18.505 [info] Restart requested ~/xx.ipynb
16:36:38.175 [info] Dispose Kernel '~/xx.ipynb' associated with '~/xx.ipynb'
16:36:39.984 [info] Starting Kernel startUsingPythonInterpreter, .jvsc74a57bd0aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49./usr/local/bin/python3./usr/local/bin/python3.-m#ipykernel_launcher (Python Path: /usr/local/bin/python3, Unknown, 3.11.6) for '~/xx.ipynb' (disableUI=true)
16:36:40.030 [warn] Failed to get activated env vars for /usr/local/bin/python3 in 37ms
16:36:40.033 [info] Process Execution: /usr/local/bin/python3 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
16:36:40.037 [info] Process Execution: /usr/local/bin/python3 -m ipykernel_launcher --ip=127.0.0.1 --stdin=9018 --control=9016 --hb=9015 --Session.signature_scheme="hmac-sha256" --Session.key=b"c45de363-ec50-4728-b9d9-d2d1eefeea7c" --shell=9017 --transport="tcp" --iopub=9019 --f=~/Library/Jupyter/runtime/kernel-v2-7605E6xM6CDCMfZX.json
> cwd: ~/analysis
16:36:40.366 [info] ipykernel version & path 6.20.2, ~/Library/Python/3.11/lib/python/site-packages/ipykernel/__init__.py for /usr/local/bin/python3
16:36:40.790 [warn] StdErr from Kernel Process 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.
16:39:32.480 [info] Loading webview. View is notset
16:39:32.481 [info] Loading web view...
16:39:32.482 [info] Webview panel created.
16:39:32.759 [info] Web view react rendered
16:41:11.232 [info] Restart requested ~/xx.ipynb
16:41:11.232 [info] Dispose Kernel process 8969.
16:41:11.262 [warn] Failed to get activated env vars for /usr/local/bin/python3 in 24ms
16:41:11.264 [info] Process Execution: /usr/local/bin/python3 -c "import ipykernel; print(ipykernel.__version__); print("5dc3a68c-e34e-4080-9c3e-2a532b2ccb4d"); print(ipykernel.__file__)"
16:41:11.267 [info] Process Execution: /usr/local/bin/python3 -m ipykernel_launcher --ip=127.0.0.1 --stdin=9023 --control=9021 --hb=9020 --Session.signature_scheme="hmac-sha256" --Session.key=b"e71a4625-3193-4124-b99f-8816fda14233" --shell=9022 --transport="tcp" --iopub=9024 --f=~/Library/Jupyter/runtime/kernel-v2-7605ZpbcQNPeUSlm.json
> cwd: ~/analysis
16:41:11.479 [info] ipykernel version & path 6.20.2, ~/Library/Python/3.11/lib/python/site-packages/ipykernel/__init__.py for /usr/local/bin/python3
16:41:11.763 [warn] StdErr from Kernel Process 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.
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 58 (27 by maintainers)
Oh yeah my bad. It installed in the local extensions but it didnt on the ssh machine.
I think it is now correct.
New logs:
Show Logs
Ok, I found out for v2023.11.1003200515 just a ‘Reload Window’ is enough to make the notebook run.
Sorry for those running into this issues Pleatsecan you followe the comments in this link anddownload this extension and try https://github.com/microsoft/vscode-jupyter/issues/14519#issuecomment-1778289425
I am out of office for the next few weeks so I won’t be able to try this fix for a while, sorry @DonJayamanne !