Why do I see multiple interpreters in my Jupyter Notebook?

When I open the Jupyter Notebook web app, I see multiple interpreters:

Ideally, I should just see the Python 3* I have installed via HomeBrew:

/usr/local/bin/python3 --> 3.9.9

and the 2.* one that comes preinstalled on macOS

/usr/bin/python --> 2.7.18

non of which are detected by the Jupyter Notebook!

I would appreciate it if you could help me know what is the problem and how I can clean it up.


To delete Interperters:

Run jupyter kernelspec list to get the paths of all your kernels. Then simply uninstall your unwanted-kernel

jupyter kernelspec uninstall unwanted-kernel

you can also just run

# List all kernels and grap the name of the kernel you want to remove
jupyter kernelspec list
# Remove it
jupyter kernelspec remove <kernel_name>

The docs has a list of the common paths for kernels to be stored in: common paths


to add your interpreters:

terminate jupyter, activate the environment you want to add a kernel for, and then run this command (requires conda install ipykernel):

python -m ipykernel install --user --name <kernel_name> --display-name "<Name_to_display>"

Make sure to replace <kernel_name> and <Name_to_display> to the name of your environment.

Once you installed the kernel, you can change to it through the above menu and even through this code snippet from a Jupyter cell:

%%javascript
Jupyter.notebook.session.restart({kernel_name: '<kernel_name>'})

you can read more here