Example of how to use a given python conda environment in a Jupyter notebook.
Create a conda environment
To install conda go to Anaconda Individual Edition . Since conda is installed in your system to create an environment (called for example hereafter worklab) use the following command:
conda create --name worklab
and then enter
source activate worklab
to activate the environment called worklab.
Note: to get a list of your environment, there is the command:
conda env list
that returns in my case for example:
# conda environments:
#
base /Users/mb/anaconda3
websitedev /Users/mb/anaconda3/envs/websitedev
websitedev2 /Users/mb/anaconda3/envs/websitedev2
worklab * /Users/mb/anaconda3/envs/worklab
Use a conda environment in a Jupyter notebook
To use for example the environment worklab that we just created in a Jupyter notebook , a solution is to use ipykernel. Enter the following command:
conda install -c anaconda ipykernel
and then
python -m ipykernel install --user --name=worklab
Now run a Jupyter notebook on your local machine using:
jupyter notebook
Then, to select the conda environment. use the dropdown menu on the right (see figure below)
or go in the menu 'kernel':
References
Links | Site |
---|---|
Anaconda Individual Edition | anaconda |
How to add your Conda environment to your jupyter notebook in just 4 steps | medium |
In which conda environment is Jupyter executing? | stackoverflow |
Conda environments not showing up in Jupyter Notebook | stackoverflow |