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
source to share
No one has answered this question yet
Check out similar questions: