0

Like many other developers, I always follow this routine when I want to launch the jupyter notebooks that run in my repository (with a pipenv virtual environment):

cd /path/to/your/repository
pipenv shell (or conda activate, or other virtualenvs)
jupyter-notebook

But this is a pain in the ass. I would like to have a desktop application that did this automatically and so I follow this guide.

The code that I put in the shell script for the launcher is exactly the routine that I do every day (the same that is above this lines).

But when I want to

source jupyterlauncher.sh

, the terminal gets stuck just after the environment activation! It is just as if ubuntu created a brand new terminal after that line.

Does anyone know how this can be achieved? Thank you in advance

2 Answers2

0

The jupyter-notebook command gets attached to the terminal, you need to send it to the background, just add an ampersand & to the end of the line, like this:

jupyter-notebook &

Remember that now you need to quit the server from the web interface.

cleary
  • 674
0

That can be done by creating a .desktop (like jupyter.desktop) file. The file content can be like...

[Desktop Entry]
Version=1.0
Name=Jupyter Notebook
Exec=bash -c 'cd /path/to/repository;source /path/to/venv/bin/activate;jupyter-notebook'
Icon=utilities-terminal
Terminal=true 
Type=Application
Categories=Application;
"/path/to/reository" should be where you want to open the jupyter notebook
"source /path/to/venv/bin/activate" is the virtual environment activation command. Change this according to your virtual environment