How to close IPython Notebook properly?
Currently, I just close the browser tabs and then use Ctrl+C
in the terminal.
Unfortunately, neither exit()
nor ticking Kill kernel upon exit
does help (they do kill the kernel they but don’t exit the iPython).
Advertisement
Answer
There isn’t currently a better way to do it than Ctrl+C in the terminal.
We’re thinking about how to have an explicit shutdown, but there’s some tension between the notebook as a single-user application, where the user is free to stop it, and as a multi-user server, where only an admin should be able to stop it. We haven’t quite worked out how to handle the differences yet.
(For future readers, this is the situation with 0.12 released and 0.13 in development.)
Update December 2017
The IPython Notebook has become the Jupyter Notebook. A recent version has added a jupyter notebook stop
shell command which will shut down a server running on that system. You can pass the port number at the command line if it’s not the default port 8888.
You can also use nbmanager, a desktop application which can show running servers and shut them down.
Finally, we are working on adding:
- A config option to automatically shut down the server if you don’t use it for a specified time.
- A button in the user interface to shut the server down. (We know it’s a bit crazy that it has taken this long. Changing UI is controversial.)