Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jupyter Erroneous Environments Showing up in Conda tab with `nb_conda` extension

Not sure how to fix this, or how it got corrupted. This is conda on a jupyterhub install.

Error Message:

EnvironmentLocationNotFound: Not a conda environment

Pics Below:

Image from Conda tab (there is an redundant anaconda3 env showing up):

enter image description here

Image of error when loading:

enter image description here

like image 439
Joseph Roberts Avatar asked Dec 28 '17 18:12

Joseph Roberts


2 Answers

This is a confirmed bug in nb_conda for conda version >=4.4:

The reason is the change of conda info --json output. Fresh installation of version 4.3.33 gives envs=[], version >=4.4 gives envs=[root_env_dir] (always non empty).

It's not fixed in current released version yet (nb_conda 2.2.1), but we can fix this bug manually, by changing the current bug code base in your local machine: ~/anaconda3/pkgs/nb_conda-2.2.1-py36h349edbb_0/lib/python3.6/site-packages/nb_conda/envmanager.py, note that your own anaconda root dir (~/anaconda3) and pkgs build version(py36h349edbb_0) might be different.

FROM:

    return {
        "environments": [root_env] + [get_info(env)
                                      for env in info['envs']]
    }

TO:

    return {
        "environments": [root_env] + [get_info(env) for env in info['envs']
                                      if env != root_env['dir']]
    }

Then, shut down any jupyter notebook server and restart one, the anaconda3 env will gone.

enter image description here

enter image description here

like image 78
YaOzI Avatar answered Sep 28 '22 07:09

YaOzI


This is either a bug in nbconda, ot a stale kernelspec file. to fix it check whether /home/user/.conda/envs/anaconda3 exists, if it does remove it.

Issue a jupyter kernelspec list in a terminal, for me it gives:

$ jupyter kernelspec list
Available kernels:
  code_scattering    /usr/local/share/jupyter/kernels/code_scattering
  meetup             /usr/local/share/jupyter/kernels/meetup
  octave             /usr/local/share/jupyter/kernels/octave
  python2            /usr/local/share/jupyter/kernels/python2
  python3            /usr/local/share/jupyter/kernels/python3
  pythonroot         /usr/local/share/jupyter/kernels/pythonroot

it should list all kernelspec and their location. Find the corresponding env and delete the folder.

like image 25
Matt Avatar answered Sep 28 '22 08:09

Matt