Installation of Jupyter on external hard disk/ USB

We have to use Jupyter notebooks for Machine Learning at our university. Jupyter needs a lot of space on the hard disk and I was able to remember (from vocational school) that we were able to install PHPMyAdmin on a USB stick. You have a transportable web application on this way. I had this goal for Jupyter and the Python environment on Linux. 🙂

So I want to give you the installation guide for Jupyter on openSUSE Leap 15.1 (incl. Python) in a virtual environment.
Install the following packages as a foundation:

 sudo zypper install python3-pip python3-devel

After that install the virtual environment with pip3:

sudo pip3 install --upgrade pip
sudo pip3 install virtualenv

Create a project directory for Jupyter in your home directory and mount the external disk/ USB stick there:

sudo mkdir ~/Jupyter
sudo mount /dev/sda1 ~/Jupyter

You have to umount /dev/sda1, if the disk has been mounted automatically in /run/media/ (in my case):

sudo umount /run/media/user/TOSHIBA\ EXT/
sudo mount /dev/sda1 ~/Jupyter

If the external disk is mounted, you can create the virtual environment for Python and Jupyter in the special project directory:

virtualenv ~/Jupyter

Inside, it will install a local version of Python and a local version of pip. We can use this to install and configure an isolated Python environment for Jupyter.
Before we install Jupyter, we need to activate the virtual environment:

source ~/Jupyter/bin/activate

You are ready to install Jupyter into this virtual environment.
You can install Jupyter on the external disk with the following command:

pip install jupyterlab

Call Jupyter via command line inside of the project directory then:

jupyter notebook

That will open your web browser with http://localhost:8888/tree.
Do you need additional packages or Python libraries? You can install them in this project directory, too.
Change to this directory and install them with pip3 (in my case these ML packages):

pip3 install scipy numpy matplotlib sklearn pandas
pip3 install keras tensorflow

Enjoy Jupyter on an external disk.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.