59

I've recently stopped using macports so the kernel.json files I had for various IPython kernels are out of date. I have renamed ~/.ipython and removed ~/.jupyter but kernels launched are failing to start with file not found errors.

More tellingly, when I run jupyter-kernelspec list it still lists all the old kernels I had set up. Where is it getting this information from and what do I need to do to refresh/remove its cache?

jbcoe
  • 3,611
  • 1
  • 30
  • 45

7 Answers7

39

After a brute force search, Jupyter stores kernel info for OS X in /Users/${USER}/Library/Jupyter/kernels. This list got copied across from my .ipython/kernels list hence renaming it made no difference.

Removing /Users/${USER}/Library/Jupyter/kernels fixes the issue.

This is the reference I was looking for: http://jupyter-client.readthedocs.org/en/latest/kernels.html#kernelspecs

jbcoe
  • 3,611
  • 1
  • 30
  • 45
  • 2
    Thanks for sharing - I kept editing the kernel files inside `~/.ipython` after getting some errors, but nothing seemed to help, until your post showed me that they are actually loaded from the `~/Library/Jupyter`. Why is that directory under `~/.ipython` even created? – Chris Sep 21 '15 at 13:41
  • recommended! this worked for installing the r kernel even when a complete reinstall anaconda, uninstall of brew, r and rstudio did not work. – scottlittle May 11 '17 at 21:48
27

As of today:

jupyter kernelspec list

gives you a list (names and paths). Then pick the name and uninstall it:

jupyter kernelspec uninstall myKernalName
23

This is an issue in Linux also if anyone else runs into it. Check the contents of: ~/.local/share/jupyter/kernels/

George L
  • 251
  • 2
  • 5
  • 4
    I can confirm that if you delete the content from the specified location and restart your notebook, it works. –  Aug 07 '16 at 15:13
  • 1
    In addition to deleting I had to run following command: `ENVS=$(conda env list | grep '^\w' | cut -d' ' -f1);for env in $ENVS; do conda activate $env; python -m ipykernel install --user --name $env; echo "$env"; conda deactivate; done` –  Apr 18 '19 at 13:26
20

Running:

jupyter --paths

will list all of the possible locations for everything it uses to run: kernels, extensions, pidfiles, etc.

bollwyvl
  • 1,231
  • 11
  • 6
12

adding to jbcoe's answer, if you're using macOS, the two locations where you should expect kernels to be installed are

/Users/${USER}/Library/Jupyter/kernels

and

/usr/local/share/jupyter/kernels
7kemZmani
  • 658
  • 1
  • 8
  • 21
10

You may run jupyter kernelspec list in terminal or !jupyter kernelspec list in a notebook cell to see a list of available kernels and the locations.

Roo
  • 862
  • 1
  • 10
  • 22
  • I have both python2 and python3 but , above command doesn't show python3 in jupyter. – DJ_Stuffy_K Jan 31 '18 at 00:25
  • It sounds like you need to install Jupyter for Python 3 see https://stackoverflow.com/questions/28831854/how-do-i-add-python3-kernel-to-jupyter-ipython – jbcoe Feb 06 '18 at 07:24
  • In my notebook, when I click Change Kernels, I see over five kernels there. But the `jupyter kernelspec list` command lists only one kernel. – Shailen Nov 30 '18 at 16:59
8

To complete the list, in Windows (at least Win 7) it is:

System-level: C:\ProgramData\jupyter\kernels

User-level: C:\Users\[username]\AppData\Roaming\jupyter\kernels

There is a folder per env(ironment) under the kernels folder. kernel.json within each subfolder is editable to change display name(s), or other parameters.

Todd
  • 201
  • 2
  • 1