Skip to content

Instantly share code, notes, and snippets.

@egormkn
Last active August 10, 2023 14:42
Show Gist options
  • Save egormkn/672764e7ce3bdaf549b62a5e70eece79 to your computer and use it in GitHub Desktop.
Save egormkn/672764e7ce3bdaf549b62a5e70eece79 to your computer and use it in GitHub Desktop.
Running JupyterLab as a desktop application on Linux

GNOME Desktop icon for Jupyter Lab

Installation

  1. Copy jupyter-lab.desktop to ~/.local/share/applications
  2. Copy jupyter-lab.svg to ~/.local/share/icons
  3. Restart gnome-desktop session (Alt+F2 -> restart)
[Desktop Entry]
Name=Jupyter Lab
Comment=Start Jupyter Lab server
Comment[ru_RU]=Запуск сервера Jupyter Lab
Exec=gnome-terminal --class jupyter-lab -x jupyter lab --port 8888
Icon=jupyter-lab
Type=Application
Categories=Development;
StartupNotify=true
StartupWMClass=jupyter-lab
Actions=open-browser
[Desktop Action open-browser]
Name=Open in browser
Name[ru_RU]=Открыть в браузере
Exec=xdg-open http://localhost:8888/lab
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@egormkn
Copy link
Author

egormkn commented Oct 8, 2020

@wesleyroseno you might have installed Jupyter Lab using pipenv or Docker. My desktop icon just launches jupyter lab --port 8888. You can replace the launch command with the one that works for you or just reinstall Jupyter Lab using pip or conda.

@tannerlegvold
Copy link

I installed JupyterLab using conda and the above did not work for me. I kept getting There was an error creating the child process for this terminal errors. Changing the EXEC command to gnome-terminal --tab -- /bin/bash -c "~/.anaconda3/bin/jupyter-lab;bash" did the trick though. Note, ~/.anaconda3 is the default location for anaconda on my system, I think its normally ~/anaconda3. So you may need to modify the this command to your system is you have to use this fix.

@Theoman22
Copy link

Theoman22 commented May 16, 2021

@tannerlegvold That EXEC command did the trick for me. I installed it in the ~/aanaconda3 directory, so I had to slightly modify that command to this:

gnome-terminal --tab -- /bin/bash -c "~/anaconda3/bin/jupyter-lab;bash"

@englianhu
Copy link

:~$ jupyter-notebook
:~$ sudo micro /home/<username>/.local/share/applications/jupyter-notebook.desktop
 [Desktop Entry]
Name=Jupyter Notebook
Comment=Run Jupyter Notebook
Exec=jupyter-notebook
Icon=jupyter-notebook
Type=Application
Categories=Development;Education
StartupNotify=true
StartupWMClass=jupyter-notebook
Actions=open-browser

and

:~$ jupyter-lab
:~$ sudo micro /home/<username>/.local/share/applications/jupyter-lab.desktop
 [Desktop Entry]
Name=Jupyter Lab
Comment=Run Jupyter Lab
Exec=jupyter-lab
Icon=jupyter-lab
Type=Application
Categories=Development;Education
StartupNotify=true
StartupWMClass=jupyter-lab
Actions=open-browser

@DobleAncho
Copy link

Thanks a lot to @tannerlegvold for detailed instruction.
It didn't work for me (in Linux Lite), so I changed the EXEC row to below (and it's working):
Exec=/home/MY_PROFILE_NAME/anaconda3/bin/jupyter-lab

@ParhamHasani
Copy link

thank you, It worked for me. first of all, I downloaded my favorite icon from Google and downloaded it with the new name of Jupyter-lab.png
after that, I moved this png file to ~/.local/share/icons with this code on the terminal:
sudo mv jupyter-lab.png ~/.local/share/icons

I create a text on my desktop in the terminal with this code:
touch jupyter-lab.desktop
then I copied these lines to this file. (Change [MYCOMPUTERNAME] with your computer name)
[Desktop Entry] Name=Jupyter Lab Comment=Run Jupyter Lab Exec=/home/[MYCOMPUTERNAME]/anaconda3/bin/jupyter-lab Icon=/home/[MYCOMPUTERNAME]/.local/share/icons/Jupyter-lab.png Type=Application Categories=Development;Education StartupNotify=true StartupWMClass=jupyter-lab Actions=open-browser
then I copied this file to ~/.local/share/applications by this code on terminal:
mv jupyter-lab.desktop ~/.local/share/applications

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment