In Visual Studio Code, when I start the Python Interactive Window (by calling "Run Selection/Line in Python Interactive Window" command, for example), Jupyter server starts in the background. In that window, I can restart the kernel, but I can not find a way to stop the server. How can it be stopped? Simply closing the interactive window only disconnects from the server, but does not stop it.
5 Answers
There is no extra function build in VSCode. But you can manage it regularly from the terminal. You can stop it using jupyter-notebook stop.
Other ways are mentioned here as well: How to close IPython Notebook properly?
1 Comment
I have just started running notebooks in VSCode (Python) and wanted to stop a running cell, but couldn't find any way.
Just out of desperation I tried to change the running cell into a markdown cell and back to a code cell. That seemed to halt the process despite being hilariously inelegant.
3 Comments
Failed to interrupt the Kernel. No kernel associated with the notebook. View Jupyter log for further details.) But it's not really consistent and I don't have a clue what it does exactly. So yea, hilariously inelegant.Finding the process in the task manager was the only option that worked for me.
If you are using the "Default" VSCode jupyter option running jupyter-notebook stop won't work. This is a known bug in vscode, but they closed the issue.
Comments
Be aware that
- Jupyter Lab
- Jupyter Notebook
and the kernel that they (they are 'servers') give you to run each Notebook are different things.
To stop a running Jupyter Notebook / Lab server, you can use the following command:
jupyter notebook stop
jupyter lab stop
This command will stop the Jupyter notebook server running on the default port (8888).
If your server is running on a different port, you need to specify it:
jupyter notebook stop {port_number}
jupyter lab stop {port_number}
Stopping the server will stop all the running kernels.
Unfortunately, there's no built-in command line interface for listing running Jupyter kernels or stopping a specific kernel. You can only do this through the Jupyter notebook or Jupyter Lab interface.
When you hover over a kernel, an x will appear for you to close it manually. [Image is JupyterLab]
Comments
I found this recommendation online for Jupyter PowerToys extension. It contains the Active Jupyter Sessions feature to shut down individual notebooks.

