kernelspec - discovering kernels

See also

Kernel specs

class jupyter_client.kernelspec.KernelSpec

The list of arguments to start this kernel.


A dictionary of extra environment variables to declare, in addition to the current environment variables, when launching this kernel.


The name to display for this kernel in UI.


The name of the language the kernel implements, to help with picking appropriate kernels when loading notebooks.


Additional kernel-specific metadata; clients can use this as needed, for instance to aid in kernel selection and filtering.

Metadata added here should be namespaced for the tool reading and writing that metadata. Concretely, if you’re adding a new field called supported_versions which your tool recognizes, then you should add it as "mytool": {"supported_versions": [1, 2]}, not as a top-level field called supported_versions.


The path to the directory with this kernel’s resources, such as icons.


Serialise this kernelspec to a JSON object.

Returns a string.

class jupyter_client.kernelspec.KernelSpecManager

Returns a dict mapping kernel names to resource directories.


Returns a dict mapping kernel names to kernelspecs.

Returns a dict of the form:

  'kernel_name': {
    'resource_dir': '/path/to/kernel_name',
    'spec': {"the spec itself": ...}

Returns a KernelSpec instance for the given kernel_name.

Raises NoSuchKernel if the given kernel name is not found.

install_kernel_spec(source_dir, kernel_name=None, user=False, replace=None, prefix=None)

Install a kernel spec by copying its directory.

If kernel_name is not given, the basename of source_dir will be used.

If user is False, it will attempt to install into the systemwide kernel registry. If the process does not have appropriate permissions, an OSError will be raised.

If prefix is given, the kernelspec will be installed to PREFIX/share/jupyter/kernels/KERNEL_NAME. This can be sys.prefix for installation inside virtual or conda envs.

exception jupyter_client.kernelspec.NoSuchKernel

The name of the kernel which was requested.

jupyter_client.kernelspec.install_kernel_spec(source_dir, kernel_name=None, user=False, replace=False)

These methods from KernelSpecManager are exposed as functions on the module as well; they will use all the default settings.