Add Virtual Environment to Jupyter Notebook

Make sure that your target environment is activated. Then run the following commands to install the ipykernel

pip install --user ipykernel

Execute the following command to attach the environment to your Jupyter Notebook

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

This should print output like the following on your screen

Installed kernelspec myenv in /home/user/.local/share/jupyter/kernels/myenv

Now you are good to go. Open the Jupyter notebook and kernel selection, and select the environment you just attached. Make sure to close the terminal and restart it but if you still don’t see your environment on the kernel selection then run the following command

conda init

Good Luck āœŒšŸ» and thanks for visiting AI Caliber

Leave a Reply

four × 2 =