If you are running Jupyter Notebook on your local Mac/Windows device and you want to make sure that you did close the application gracefully, then here are a few ways to do it.
Option 1: Using the Menu Option
This is the the best and the ideal way to close a Notebook application.
Simply go to Menu: File and select Shut Down at the bottom.
You will get an alert asking if you really want o shutdown JupyterLab.
Once you click on "Shut Down" button, you will notice that the Command Line/Terminal that was running the Notebook server gets closed and so does the Browser tab.
Option 2: Using Command "jupyter notebook stop"
Open a new instance of your Terminal (CMD if on Windows) and run the below command.
jupyter notebook stop
You will notice that the Jupyter Notebook Server has stopped with logs as,
[I 2023-07-26 03:53:25.476 ServerApp] Shutting down on /api/shutdown request.
[I 2023-07-26 03:53:25.476 ServerApp] Shutting down 6 extensions
Option 3: The Quickest way - Control + C Twice
This is the quickest way to terminate a Notebook server, by pressing Control + C twice on the console.
^C[I 2023-07-26 03:55:33.181 ServerApp] interrupted
[I 2023-07-26 03:55:33.182 ServerApp] Serving notebooks from local directory: /Users/c2ctechtv
0 active kernels
Jupyter Server 2.7.0 is running at:
http://localhost:8888/tree?token=9dc1b9a830102024b31a2e78069f69469185eb19b9eb2223
http://127.0.0.1:8888/tree?token=9dc1b9a830102024b31a2e78069f69469185eb19b9eb2223
Shutdown this Jupyter server (y/[n])? y
[C 2023-07-26 03:55:34.759 ServerApp] Shutdown confirmed
[I 2023-07-26 03:55:34.761 ServerApp] Shutting down 6 extensions
When you press Control + C once you will see a message on console "Shutdown this Jupyter server (y/[n])" if you press Control + C again or type y will shutdown the server.
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- How to convert int to ASCII in Python
- How to make use of SQLite Module in Python?
- Split a String into Sub-string and Parse in Python
- Python: Pandas Rename Columns with List Example
- How to run Python file from Mac Terminal
- How to Exit a Loop in Python Code
- Python: How to Plot a Histogram using Matplotlib and data as list
- MD5 Hashing in Python
- Jupyter: Safari Cant Connect to the Server localhost:8888/tree
- Fix: AttributeError: str object has no attribute decode. Did you mean: encode?[Python]
- How to Read a binary File with Python
- How to add two float numbers in Python
- Python: How to install YAML Package
- Python: How to Save Image from URL
- What is Markdown in Jupyter Notebook with Examples
- How to change the Python Default version
- 33: Python Program to send an email vid GMail
- How to comment code in Python
- How to Fix AttributeError in Python
- Fix: error: Jupyter command `jupyter-nbconvert` not found [VSCode]
- How to comment out a block of code in Python
- List of All 35 Reserved Keywords in Python Programming Language 3.11
- Import Other Python Files Examples
- Python: How to add Progress Bar in Console with Examples
- 3 Ways to convert bytes to String in Python
- Android Development - How to switch between two Activities - Android
- Create simple struts2 project using maven commands - Java
- Increase or Decrease macOS Sonoma Sidebar Icon and Text Size - MacOS
- How to Measure Execution Time in Jupyter Notebook Cell - Python
- Python: Convert Minutes to Hours - Python
- Where are Plugins Installed in Notepad++ - NotepadPlusPlus
- [Android Studio] Error: Missing system image on device - Android-Studio
- How to hide toolbar on Notepad++ - NotepadPlusPlus