Installing Jupyter Notebook (Offline mode)
Use the following steps to install Jupyter Notebooks in an offline
environment.
Procedure
- Do the following steps using an online server:
- As the root user, run the following command to install the Python
virtual environment.
/usr/local/bin/pip3.5 install virtualenv
- Run the following command to create and activate a virtual environment.
virtualenv jup_env
. ./jup_env/bin/activate
Note: Ensure that you include the 2 periods in the command.The cursor prompt changes to show that all further changes will affect the virtual environment.
(jup_env) [root@ ~]#
You can exit the virtual environment by entering the following command:
deactivate
- Create the offline installation directory.
mkdir ./jup_env/jupyterinstall
- Create a text file that is named constraints.txt and includes the
following entries:
backcall==0.1.0 bleach==1.5 html5lib==0.9999999 parso==0.3.1
- Download the required packages to the offline folder.
pip3.5 download -d ./jup_env/jupyterinstall jupyter==1.0.0 -c constraints.txt
Note: This step uses the virtual environment instance of pip3.5. Do not change to /usr/local/bin/pip3.5. - Compress the offline installation directory.
tar -czvf jupyterinstall.tar.gz ./jup_env/jupyterinstall
- Copy the compressed file to the offline server.
scp jupyterinstall.tar.gz root@<offline_host>:/home/sifsuser/
- Exit the virtual environment.
deactivate
- As the root user, run the following command to install the Python
virtual environment.
- Do the following steps using the offline server:
- Log in to the offline server as the root user.
- Decompress the offline installation folder.
cd /home/sifsuser
tar -xzvf /home/sifsuser/jupyterinstall.tar.gz
- Install Jupyter.
/usr/local/bin/pip3.5 install --no-index --find-links=/home/sifsuser/jup_env/jupyterinstall/ jupyter
Note: The command is all that is required to install Jupyter and its dependencies. In addition, there is a requirements.txt file in the /home/sifsuser/jupyterinstall directory in case an itemized list or a version controlled list of Python packages is required.