Adding a virtual environment in Jupyter notebook

First, activate your virtual environment (shell) and run this:

pip install --user ipykernel

We need to manually add the kernel if we want to have the virtual environment in the Jupyter Notebook. That is why we need to add it by running this code.

python -m ipykernel install --user --name=myenv

 

image.png

when creating a new notebook, you can choose your new kernel image

 

If you have finished with the virtual environment and did not need it anymore, you could remove it using this code.

jupyter kernelspec uninstall myenv

Revision #1
Created 25 August 2022 17:39:58 by Laura Wagner
Updated 12 April 2023 13:00:54 by Laura Wagner