Adding a Conda Environment to Jupyter Notebook

We will show you how easy it is to create a conda environment and adding it to your Jupyter notebook.

If you haven't launched a Jupyter notebook on RONIN, you'll want to read the Accessing a Jupyter notebook with RONIN on how to do so before returning here

I have created and launched my Jupyter notebook already, let's get started!

Step 2 - Update to the latest Conda
conda update -n base -c defaults conda
Step 3 - Create your Conda environment. In this example I've called it myenv
conda create -n myenv
Step 4 - Activate your Conda environment

You may need to define your shell. In this example I've used bash.

 conda init bash

Close and re-open your current shell to save the above changes. Then run the below code to activate your environment.

conda activate myenv

You can install required packages you want in this environment.

Step 5 - Now comes the step to set this Conda environment on your jupyter notebook, to do so install ipykernel.
 pip install --user ipykernel 
Step 6 - Activate your Conda environment
python -m ipykernel install --user --name=myenv

Yes!!! You now have connected your virtual environment to your Jupyter machine.