nb_conda_kernels icon indicating copy to clipboard operation
nb_conda_kernels copied to clipboard

`nb_conda_kernels.install --disable` not working

Open hackalog opened this issue 4 years ago • 6 comments

I originally mentioned this in the comments in #112. It feels like a bug (but please let me know otherwise).

On my system (MacOS, python==3.7.6, nb_conda_kernels==2.2.2) my conda environments simply weren't appearing, regardless of how many times I installed/uninstalled nb_conda_kernels.

At some point during my troubleshooting, I noticed that

python -m nb_conda_kernels.install -v --disable

was failing to disable the extension.

$ python -m nb_conda_kernels.install -v --disable
Disabling nb_conda_kernels...
Entry points:
  - conda = nb_conda_kernels.discovery:CondaKernelProvider
Removing from local configuration
Writing config in /Users/hackalog/miniconda3/envs/nlp/etc/jupyter...
jupyter_notebook_config.json entries:
  - /etc/jupyter: <no file>
  - /usr/local/etc/jupyter: <no file>
  * /Users/hackalog/miniconda3/envs/nlp/etc/jupyter: {
      "NotebookApp": {
        "nbserver_extensions": {
          "nb_conda": true
        }
      }
    }
  - /Users/hackalog/.jupyter: <no file>
Status: enabled

Notice the Status: enabled at the end.

I traced through that code, and in the end, noticed the disabled == True (line 145) code path of https://github.com/Anaconda-Platform/nb_conda_kernels/blob/1b9e821e7cafe388b633ba4fdb8feb3eec815d6c/nb_conda_kernels/install.py#L140-L151 was not getting entered. I can't tell if that's intentional, or just a missed case in the refactored if statement on line 140.

(In my case, status == False, is_enabled_local == False, enable == False, and is_enabled_entry == True, which is why the code was ignored)

When I backed nb_conda_kernels all the way back to 2.1.1 (before that code path was refactored) , I finally succeeded in disabling nb_conda_kernels; i.e. the config file was changed to:

{
  "NotebookApp": {}
}

Upon re-enabling it, I could finally see all my conda environments (yay). The new config file was

{
  "NotebookApp": {
    "kernel_spec_manager_class": "nb_conda_kernels.CondaKernelSpecManager"
  }
}

But at this point, updating to 2.2.2 will cause an error.

hackalog avatar Mar 23 '20 18:03 hackalog

Interesting. In fact, nb_conda_kernels is not enabled in that configuration. nb_conda is a different package. I think this helps me understand the potential issue.

mcg1969 avatar Sep 07 '20 15:09 mcg1969

I cannot for the life of me reproduce this. That said, there is one important thing I noticed—we're using "JupyterApp" now instead of "NotebookApp". I'm not 100% sure what the consequences are of that.

mcg1969 avatar Sep 07 '20 16:09 mcg1969

@fcollonval I think maybe that the presence of both jupyter_config.json and jupyter_notebook_config.json might be an issue.

mcg1969 avatar Sep 07 '20 16:09 mcg1969

#182 is my attempt to address the NotebookApp/JupyterApp and jupyter_config/jupyter_notebook_config differences.

mcg1969 avatar Sep 08 '20 15:09 mcg1969

@fcollonval I think maybe that the presence of both jupyter_config.json and jupyter_notebook_config.json might be an issue.

The change has not yet been released. So I do not think the configuration file name is responsible for this particular issue. But nevertheless the question is pertinent for the latest version.

fcollonval avatar Sep 08 '20 17:09 fcollonval

Ah, good point, of course you're right.

mcg1969 avatar Sep 08 '20 17:09 mcg1969

Closing as stale and because I'm pretty sure it is adequately covered by other issues around updated kernel management

mcg1969 avatar Mar 06 '24 23:03 mcg1969