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
  4. Frequently Asked Questions

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 complete the miniconda setup with:

    source $MINICONDA_HOME/etc/profile.d/conda.sh 
    
  3. Ceate a conda environment:

    conda create --name <myenv>
    
  4. Activate your environment:

    conda activate <myenv>
    
  5. Install your packages:

    conda install <mypackage>
    
  6. Install the ipykernel package:

    conda install ipykernel
    
  7. 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

FAQ

  1. Question: My conda commands are interrupted with message 'Killed'. What can I do?

    Answer: Request more memory when starting Jupyter. In the job settings open 'Cluster Settings' and look for the option 'Memory / node'.

  2. Question: How can I navigate to my SDS@hd folder in the file browser?

    Answer: Open a terminal and set a symbolic link to your SDS@hd folder in your home directory. For example:

    $ cd $HOME
    $ mkdir sds-hd
    $ cd sds-hd
    $ ln -s /mnt/sds-hd/sd16a001 sd16a001