Skip to content

JupyterLab

Anaconda

Default conda environment

You can use the default conda environment in the JupyterLab portal app. For example, on the FASTER (ACCESS) portal, you can select Anaconda3/2022.10 and leave the 'Optional Conda Environment to be activated' field blank.

Custom Anaconda conda environment

You can create your own JupyterLab conda environment using Anaconda for use on the HPRC portal but you must use one of the Anaconda versions that are on the JupyterLab. You can find the available versions on the portals below.

Notice that you will need to make sure you have enough available file quota (~30,000) since conda creates thousands of files.

To create an Anaconda (Here we use Anaconda3/2022.10 for example) conda environment called jupyterlab, do the following on the command line:

module purge
module load Anaconda3/2022.10
conda create -n jupyterlab

After the jupyterlab environment is created, you will see output on how to activate and use your jupyterlab environment

#
# To activate this environment, use:
# > source activate jupyterlab
#
# To deactivate an active environment, use:
# > source deactivate
#

Then you can install jupyterlab (specifying a version if needed) and add packages to your jupyterlab environment

source activate jupyterlab
conda install -c conda-forge jupyterlab
conda install -c conda-forge <package-name>

You can specify a specific package version with the install command. For example to install pandas version 2.2.0:

conda install -c conda-forge pandas=2.2.0

To remove downloads after packages are installed.

conda clean -t

When using Anaconda3/2022.10, use just the environment name in the 'Optional Environment to be activated' field which in this example will be jupyterlab

NOTE: When using Anaconda to create a virtualenv, it will add lines to your ~/.bashrc file that you should delete since these lines which automatically load your virtualenv which will interfere with other jobs and modules.

Python

Default python virtualenv

You can use the default virtualenv in the JupyterLab portal app. For example, on the FASTER(ACCESS) portal, you can select Python/3.8.2 or Python/3.9.5 and leave the 'Optional Conda Environment to be activated' field blank.

The default virtualenv has Jupyterlmod installed which allows you to load compatible software modules to use in your notebook.

Type 'toolchains' on the cluster shells to see a table of compatible toolchains.

To load additional software modules, click the 'Softwares' icon in the left most part of your JupyterLab notebook. Search for modules with a compatible toolchain (such as TensorFlow/2.2.0-foss-2019b-Python-3.7.4) and click 'Load' once and wait for the LOADED MODULES section to refresh.

If you have already started your notebook before loading modules, you will need to restart the kernel in order for the loaded module to be available by clicking Kernel -> Restart Kernel... in the top JupyterLab menu or click the 'Restart the kernel' icon at the top of the notebook.

If you get 'Server Connection Error' messages after restarting the kernel, stop all other notebooks you are running by clicking the 'Running Terminals and Kernels' button in the left panel menu and then 'SHUT DOWN' all other running KERNEL SESSIONS.

Custom python virtualenv

You can create your own virtualenv to use with the JupyterLab portal app but in most cases the default virtualenv should work for you.

You must create your virtualenv using one of the Python modules listed on the JupyterLab app. You can find the available versions on the portals below.

Here is an example of creating your own virtualenv on a login node.

module load Python/3.9.5
mkdir -p /scratch/user/<your_netid>/pip_envs/Python/3.9.5
cd /scratch/user/<your_netid>/pip_envs/Python/3.9.5
virtualenv jupyterlab
source /scratch/user/<your_netid>/pip_envs/Python/3.9.5/jupyterlab/bin/activate
pip install juypter
pip install jupyterlab
pip install <additional_packages>

Then in the JupyterLab portal app, select the Python/3.9.5 Module and enter the full path of the activate command found in your virtualenv into the 'Optional Conda Environment to be activated' field.

Example of what to enter in the 'Optional Conda Environment to be activated' field:

/scratch/user/<your_netid>/pip_envs/Python/3.9.5/jupyterlab/bin/activate

Web Access

Although compute nodes do not have access to the internet, the JupyterLab app uses a proxy server by default which allows your JupyterLab session to have access to the internet.

Back to top