bwVisu

Jupyter User Guide

Table of contents

  1. How to add python packages to Jupyter
    1. Via virtual environments
    2. Via miniconda
  2. How to update the python version
  3. How to use R in Jupyter

How to add python packages to Jupyter

Via virtual environments

  1. Open a terminal and type:
    python3 -m venv <myEnv>
    
  2. Activate your environment:
    source <myEnv>/bin/activate
    
  3. Install your packages:
    pip install -U pip
    pip install <mypackage>
    
  4. Install the ipykernel package:
    pip install ipykernel
    
  5. Register your virtual environment as custom kernel to Jupyter:
    python3 -m ipykernel install --user --name=<myKernel>
    

Via miniconda

  1. Load the miniconda module by clicking first on the blue hexagon icon on the left-hand side of Jupyter's start page and then on the "load" Button right of the entry for miniconda in the software module menu: Screenshot at 2022-02-10 13-47-37
  2. Open a terminal and type:
    conda create --name <myenv>
    
  3. Activate your environment:
    conda activate <myenv>
    
  4. Install your packages:
    conda install <mypackage>
    
  5. Install the ipykernel package:
    conda install ipykernel
    
  6. Register your virtual environment as custom kernel to Jupyter:
    python3 -m ipykernel install --user --name=<myKernel>
    

How to update the python version

  1. Activate the Miniconda module as shown in the previous section.
  2. Create a virtual environment with a custom python version via conda:
    conda create --name <myenv> python=<python version>
    
  3. Install the ipykernel package:
    conda install ipykernel
    
  4. Register your virtual environment as custom kernel to Jupyter:
    python3 -m ipykernel install --user --name=<myKernel>
    
  5. Select your newly created kernel in Jupyter

How to use R in Jupyter

  1. On the cluster:
    $ module load math/R
    $ R
    > install.packages('IRkernel')
    
  2. On bwVisu:
    1. Start Jupyter App
    2. In left menu: load math/R
    3. Open Console:
    $ R
    > IRkernel::installspec(displayname = 'R 4.2')
    
    1. Start kernel 'R 4.2' as console or notebook