Skip to content

How To Setup Jupyter Notebook In Conda Environment And Install Kernel

How to setup Jupyter Notebook in a conda environment and then install the kernel


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.


FREE VS Code / PyCharm Extensions I Use

✅ Write cleaner code with Sourcery, instant refactoring suggestions: Link*


Python Problem-Solving Bootcamp

🚀 Solve 42 programming puzzles over the course of 21 days: Link*

* These are affiliate link. By clicking on it you will not have any additional costs. Instead, you will support my project. Thank you! 🙏