Jupyter Notebook, JupyterLab, TensorFlow, PyTorch

Table of Contents

    We recommend to use Open OnDemand https://apps.hpc.ntnu.no . There are several alternatives to start Jupyter.

    Option 1 - use environment module

    If you do not have your own Virtual Environment with JupyterLab or Jupyter Notebook yet than you can use environment module:

    module load JupyterNotebook/7.2.0-GCCcore-13.2.0

    Option 2 - advanced use

    You will use one of pre-installed Python environment modules. You can create your own Python virtual environment from scratch:

    module load Python/3.12.3-GCCcore-13.3.0
    python -m venv /cluster/home/[USERNAME]/MyPythonEnv
    source /cluster/home/[USERNAME]/MyPythonEnv/bin/activate
    pip install notebook
    pip install jupyterlab

    Or load your existing Python Virtual Environment:
    You will need to update "Environment Setup" to load the same environment module:

    Run Jupyter Notebook and TensorFlow (CUDA, GPU)

    There are several TensorFlow Environment Modules installed on IDUN:

    $ module avail TensorFlow
    TensorFlow/2.11.0-foss-2022a-CUDA-11.7.0
    TensorFlow/2.11.0-foss-2022a
    TensorFlow/2.13.0-foss-2023a

    This is example with GPU/CUDA:

    Check how many GPUs available:

    Run Jupyter Notebook and PyTorch

    There are several PyTorch Environment Modules installed on IDUN:

    $ module avail PyTorch
    PyTorch/1.12.0-foss-2022a-CUDA-11.7.0
    PyTorch/1.12.1-foss-2022a-CUDA-11.7.0
    PyTorch/1.13.1-foss-2022b
    PyTorch/2.0.1-foss-2022a

    Example with torchvision and GPU:

    Check available GPU:

    Jupyter with custom Python virtual environment

    Create python virtual environment PyEnv1 from command line:

    module load Python/3.12.3-GCCcore-13.3.0
    python -m venv /cluster/home/[USERNAME]/PyEnv1
    source /cluster/home/[USERNAME]/PyEnv1/bin/activate
    pip install jupyterlab
    pip install notebook
    pip install matplotlib
    pip install netCDF4
    pip install geopandas
    pip install scikit-learn
    pip install seaborn
    deactivate

    Set Environment Setup on https://apps.hpc.ntnu.no for Jupyter Notebook or Jupyter Lab:

    module load Python/3.12.3-GCCcore-13.3.0
    source /cluster/home/[USERNAME]/PyEnv1/bin/activate

    Screenshot:

    Scroll to Top