To add a Jupyter Notebook launcher to start a Jupyter notebook from the applications menu do the following:
Create a jupyter-notebook.desktop
file in ~/.local/share/applications
:
touch ~/.local/share/applications/jupyter-notebook.desktop
Open the file with a text editor (I'm using nano
):
nano ~/.local/share/applications/jupyter-notebook.desktop
Add the following to the file:
[Desktop Entry]
Comment=Open a Jupyter Notebook in your browser
Terminal=false
Name=JupyterNotebook
Exec="/full/path/to/jupyter-notebook" %f
Type=Application
Note that in the Exec
field you have to use the full path to jupyter-notebook
. So in your case you should add something like /home/user/.local/bin/jupyter-notebook
instead of ~/.local/bin/jupyter-notebook
, where user
is your actual username.
Save and close the file (Ctrl+O and then Ctrl+X in nano
).
That's it! You should now be able to run Jupyter Notebook from your applications menu.
Note: Every time you open a Jupyter Notebook this way, a new Jupyter server will be launched as well, although without being shown in a terminal. If you close the browser tab that Jupyter Notebook runs in, the server will continue to run. So you'll have to close the server yourself. To do that you can use the jupyter notebook list
command in a terminal, which will list all running servers, and then you'll have tot use jupyter notebook stop port
, where port
is the port that localhost runs on.
For example, I have started three Jupyter Notebooks using the applications menu launcher and I have closed the browser tabs. jupyter notebook list
shows:
Currently running servers:
http://localhost:8889/?token=23b2468a3229ca7a18430cd48039fd95e0e6866d2a8cd5d5 :: /home/user
http://localhost:8888/?token=406937f75d9e564986d0e1c7929a9119c95eeff01b5bcca8 :: /home/user
http://localhost:8890/?token=2fa24c5385fe7dc4d0fc91cf267cff029571614e272f8453 :: /home/user
To close them I have to run:
jupyter notebook stop 8889
jupyter notebook stop 8888
jupyter notebook stop 8890