How do I delete/refresh available kernels for IPyt

2019-01-21 16:41发布

问题:

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?

回答1:

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



回答2:

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



回答3:

Running:

jupyter --paths

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



回答4:

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


回答5:

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.



回答6:

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.