How to manage your envs in jupyter

Jupyter
Machine Learning

common operations on management of jupyter envs

Author

Guofeng Lin

Published

July 21, 2021

How to add an env in Jupyter

Step 1: install ipykernel in your envs

one way is to install ipykernel when you create a new env

conda create -n [your_env_name] python=\[python_version_you_want\] ipykernel

for example:

conda create -n test_env python=3.6 ipykernel

another way is to install ipykernel in existing env

source activate [your_env_name]
conda install -n [your_env_name] ipykernel

for example:

source activate existed_env
conda install -n existed_env ipykernel

Step 2: config your env in Jupyter kernel

source activate [your_env_name]
python -m ipykernel install --user --name [your_env_name] --display-name [display_name]

for example, if you want to config new_env to Jupyter kernel:

source activate new_env
python -m ipykernel install --user --name new_env --display-name "new_env"

How to Delete Env in Jupyter?

Step 1: check Jupyter kernel

jupyter kernelspec list

Step 2: delete the specific kernel

jupyter kernelspec uninstall [your_env_name]