Activating an Anaconda environment in Jupyter Notebook

Viewed 281

I have created a conda environment at the command line and installed ipykernel and Jupyter on MacOS 10.14.6 (Mojave) with Conda 4.8.5

(base) Bens-MacBook-Pro:~ benbogart$ conda create --name testenv
(base) Bens-MacBook-Pro:~ benbogart$ conda activate testenv
(testenv) Bens-MacBook-Pro:~ benbogart$ conda install -c conda-forge notebook
(testenv) Bens-MacBook-Pro:~ benbogart$ conda install ipykernal
(testenv) Bens-MacBook-Pro:~ benbogart$ python -m ipykernel install --user --name=testenv

Now if I go into the Jupyter Notebook tree I can see the environment listed:

Image from Jypyter Notebook Tree

But if I open a new notebook with that option, it opens with the base environment, not the new test environment.

In the notebook I run

!echo $CONDA_PREFIX

and get

/Users/benbogart/opt/anaconda3

But if I open Jupyter from the command line:

(testenv) Bens-MacBook-Pro:~ benbogart$ Jupyter Notebook

The notebook uses the testenv even if I select another env in the the Jupyter file tree.

In the notebook I run

!echo $CONDA_PREFIX

and get

/Users/benbogart/opt/anaconda3/envs/testenv

What step am I missing to get the conda environment to work from within Anaconda navigator?

Thanks!

0 Answers
Related