Whenever I setup a new conda environment and want to use a jupyter notebook with the correct Kernel for this environment, I find myself googling this over and over again. So I finally decided to list the necessary commands here.
How To Install Jupyter Notebook And The Kernel In Your Conda Environment
Assuming your conda-env is named ml
, it is as simple as:
$ conda activate ml
(ml) $ conda install ipykernel
(ml) $ ipython kernel install --user --name=<any_name_for_kernel>
(ml) $ conda deactivate
conda install ipykernel
installs all dependencies needed to use jupyter.
ipython kernel install --user --name=<any_name_for_kernel>
installs the kernel for this environment. I usually use the same kernel name as the environment name here (i.e. ml
in this example).
Source: Stackoverflow.
How To Remove/Uninstall a Kernel Again
Run jupyter kernelspec list to get the paths of all your kernels.
$ jupyter kernelspec list
Then simply uninstall your unwanted-kernel:
$ jupyter kernelspec uninstall unwanted-kernel
Source: Stackoverflow.
I hope this saves someone else some time as well 😊.
If this is helpful, you might also like my Anaconda Basics Tutorial.