Ipython - get a list of all kernels (user + default)

I'm looking for a way to get a list (or dict) with the names of all installed ipython kernels on systems programmatically (not via the command line). So far I have this:

from jupyter_client.kernelspecapp import KernelSpecManager
print(KernelSpecManager().find_kernel_specs())

      

or (but this gives a failure warning):

from IPython.kernel.kernelspec import find_kernel_specs
print(find_kernel_specs())

      

There is also a way using ipykernel, but no documents were found.

All of the above gives me a dictionary with kernels that I installed using ipykernel

, but not the default kernel (for example Python 3

), which is shown in the notebook:

{'lab2': '/home/alex/.local/share/jupyter/kernels/lab2',
 'lab3': '/home/alex/.local/share/jupyter/kernels/lab3',
 'python2': '/usr/local/share/jupyter/kernels/python2'}

      

Is there a way to get a list of all kernels?

+3
python ipython jupyter


source to share


No one has answered this question yet

Check out similar questions:

3474
How to list all files in a directory?
1798
Getting the last item in a list
1782
How can I get the number of items in a list?
nine
Jupyter notebook import error: no module named "matplotlib"
8
Anaconda: Python 3 and 2 in IPython / Jupyter Notebook
2
How do I make kernelspec available to Jupyter and iPython?
2
Installing a torch changed the configuration of the Jupyter notebook
1
ERROR: ipykernel requires Python 3.4 or higher
1
Is there any shortcut other than the arrow to scroll through the ipython autocomplete list?
0
Jupyter Kernel does not match display_name in kernel.json file



All Articles
Loading...
X
Show
Funny
Dev
Pics