Ubuntu 18.04 - open jupyter notebook with double click?
Is there a way to configure Ubuntu 18.04 to open Jupyter Notebooks with a double click from the graphical file browser?
There are 2 prominent Stack Overflow posts on the subject:
https://stackoverflow.com/questions/30953227/double-click-to-open-an-ipython-notebook
https://stackoverflow.com/questions/30953227/double-click-to-open-an-ipython-notebook/30955613
But most of the answers here pertain to MacOS, and the few relating to Linux did not seem to work for me on Ubuntu 18.04.
Something completely different from the above that I tried was to make a desktop file:
cd ~/.local/share/applications
gedit jupyter_notebook.desktop
In Gedit I entered this:
[Desktop Entry]
Comment=
Terminal=false
Name=JupyterNotebook
Exec="jupyter notebook" %f
Type=Application
But this did not work. Double-clicking on a .ipynb file still opens it in Chrome and shows the .json contents rather than running it as a notebook.
Has anybody actually gotten this functionality to work with Ubuntu 18.04?
Solution 1:
You have to enter the full path to the jupyter-notebook
executable in the Exec
field of your .desktop file.
You can find the full path of jupyter-notebook
by running:
which jupyter-notebook
So your .desktop file would become:
[Desktop Entry]
Comment=
Terminal=false
Name=JupyterNotebook
Exec="/full/path/to/jupyter-notebook" %f
Type=Application
You also have to make your .desktop file executable, if you haven't already, by running:
chmod u+x ~/.local/share/applications/jupyter_notebook.desktop
Finally, right-click a .ipynb file, go to Properties → Open With → select JupyterNotebook from the list → Set as default.