How to Create a Conda Environment for Jupyter Notebook OnDemand

This tutorial shows step by step how to create a conda environment for Jupyter Notebook OnDemand.

1. Log in to the Grid. Start an interactive job: srun -q primary -N 1 -n 8 --mem 4G -t 10:00:00 --pty bash

Image

2. After being assigned a node, run the following: ml python/3.7

  • Type: conda create -n myenv

Image

  • Enter y to proceed.

Image

3. After the environment is created, it can be activated.

  • Type: conda activate myenv

Image

4. Install the packages pip and ipykernel.

  • Type: conda install pip ipykernel

Image

Image

Image

5. Next, you can create a visible kernel for your conda environment.

  • Type: python -m ipykernel install --user --name myenv --display-name "Python (myenv)"

Image

Now the environment will be available within Jupyter Notebook on OnDemand.