by Cadair

An Jupyter plugin to enable the automatic detection of conda and virtualenv environments as kernels.

131 Stars 18 Forks Last release: over 2 years ago (v1.1.1) BSD 2-Clause "Simplified" License 77 Commits 2 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Automatic Environment Kernel Detection for Jupyter

A Jupyter plugin to enable the automatic detection of environments as kernels.

This plugin looks in the directories you specify for installed environments which have Jupyter installed and lists them as kernels for Jupyter to find. This makes it easy to run one notebook instance and access kernels with access to different versions of Python or different modules seamlessly.


The plugin can be installed with:

pip install environment_kernels

To enable the plugin add the following line to your notebook config file:

c.NotebookApp.kernel_spec_manager_class = 'environment_kernels.EnvironmentKernelSpecManager'

To create a config file run:

jupyter notebook --generate-config

or run the notebook with the following argument:


Search Directories for Environments

The plugin works by getting a list of possible environments which might contain an ipython kernel.

There are multiple ways to find possible environments:

  • All subdirs of the base directories (default:
    for conda based environments and
    ) for virtualenv based environments.
  • If the jupyter notebook is being run in the conda root environment
    will be imported and all subdirs of these dirs will be added to the list of possible environments.
  • If the notebook server is run from inside a conda environment then the
    variable will be set and will be used to find the directory which contains the environments.
  • If a
    executeable is available, it will be queried for a list of environments.

Each possible environment will be searched for an

executeable and if found, a kernel entry will be added on the fly.

The ipython search pattern is on Linux and OS/X:


and on Windows:


The kernels will be named after the type (conda or virtualenv) and by the name of the environment directory (example: the kernel in conda environment

gets the name
). If there are multiple envs which would result in the same kernel name (e.g. when multiple base dirs are configured, which each contain an environment with the same name), only the first kernel will be used and this ommision will be mentioned in the notebook console log.

You can configure this behaviour in mutliple ways:

You can override the default base directories by setting the following config values:


You can also disable specific search paths:


The above disables both types of environments, so this will effectivly disable all environment kernels.

You can also disable only the conda call, which is expensive but the only reliable way on windows:


Limiting Environments

If you want to, you can also ignore environments with certain names:


Or you can specify a whitelist of "allowed" environments with:


Configuring the display name

The default lists all environmental kernels as

Environment (type_name)
. This can be cumbersome, as these kernels are usually sorted higher than other kernels.

You can change the display name via this config (you must include the placeholder

c.EnvironmentKernelSpecManager.display_name_template="~Env ({})"

Config via the commandline

All config values can also be set on the commandline by using the config value as argument:

As an example:




We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.