nb_conda_kernels: conda 4.4.7 does not work with nb_conda_kernels in new/reinstalled envs

In base env my launch log for a jupyter notebook looks like that:

(stable) └─❱❱❱ conda activate base                                                   +9035 17:51 ❰─┘

┌─( ~/D/src )────────────────────────────────────────────────────────────────────────( @macd2860 )─┐
(base) └─❱❱❱ jn .                                                                    +9036 17:51 ❰─┘
[I 17:51:31.745 NotebookApp] [nb_conda_kernels] enabled, 8 kernels found
[I 17:51:32.046 NotebookApp] Loading IPython parallel extension
[I 17:51:32.063 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.3.0
[I 17:51:32.066 NotebookApp] Serving notebooks from local directory: /Users/klay6683/Dropbox/src
[I 17:51:32.066 NotebookApp] 0 active kernels

I recently reinstalled by stable setup, which is a Python 3.6 env with all my everyday packages and no GH master stuff. Since the reinstall, nb_conda_kernels can’t call conda from within the stable env:

(base) └─❱❱❱ conda activate stable                                                   +9037 17:52 ❰─┘

┌─( ~/D/src )────────────────────────────────────────────────────────────────────────( @macd2860 )─┐
(stable) └─❱❱❱ jn .                                                                  +9038 17:52 ❰─┘
[E 17:52:50.245 NotebookApp] [nb_conda_kernels] couldn't call conda:
    [Errno 2] No such file or directory: 'conda': 'conda'
[I 17:52:50.246 NotebookApp] [nb_conda_kernels] enabled, 0 kernels found
[I 17:52:50.540 NotebookApp] Loading IPython parallel extension
[I 17:52:50.557 NotebookApp] [jupyter_nbextensions_configurator] enabled 0.3.0
[I 17:52:50.560 NotebookApp] Serving notebooks from local directory: /Users/klay6683/Dropbox/src
[I 17:52:50.560 NotebookApp] 0 active kernels

while my older envs still work fine, e.g. my Python 3.5 env.

I noticed that I can of course run my work from the base env because my kernels from the other envs are being found there, but imagine it wouldn’t be working there as well, then I couldn’t work at all, because I don’t recall anymore how to manually install kernels, so scary indeed.

I’m running these on a macOS 10.12.6 with miniconda3 and conda-forge as default.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18

Most upvoted comments

I don’t think this issue has been fixed yet.

Running from jupyter,nb_conda_kernels tries to call the conda executable to get information about all the environments.

The problem is that since conda 4.4 it appears there is no link to the conda executable added to new/reinstalled envs, which therefore cannot be found in $PATH, hence the error above.

For environments that have been created before conda 4.4 it still works because a link to the conda executable is still present in those envs. This also works with the base environment since the conda executable is installed in that env.

A workaround for new/reinstalled envs would be for example to manually create a symlink to the conda executable in their bin folders.

A cleaner solution would be that nb_conda_kernels uses the $CONDA_EXE env variable to find the conda exectuable.

xref: https://github.com/jupyterlab/jupyterlab/issues/4598

Thanks @mcg1969. It looks like the 2.1.1 packages are all up on conda-forge now! https://anaconda.org/conda-forge/nb_conda_kernels

However, after installing this package on my mac, the extension is not enabled by default. I have to run: python -m nb_conda_kernels.install --enable

This used to be done in a post-link script that was shipped in the package. Is this change intentional?

[Also, if Continuum is not going to update this package in defaults, should it be removed from there?]

@michaelaye some of my systems are still running processes so i am not ready to shut them down yet. For the one of my Ubuntu, removing: _nb_ext_conf (conda remove -n <env_name> _nb_ext_conf), fixes the problem and am able to see different environment, including IRKernel.

I’ve submitted a conda-forge PR https://github.com/conda-forge/nb_conda_kernels-feedstock/pull/18 I don’t know what is involved in getting it merged.

was this fixed in 2.1.1? If yes, I’m not seeing that version on any osx-64 channel?