Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nb_conda_kernels.install --disable not working #158

Closed
hackalog opened this issue Mar 23, 2020 · 7 comments
Closed

nb_conda_kernels.install --disable not working #158

hackalog opened this issue Mar 23, 2020 · 7 comments

Comments

@hackalog
Copy link

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.

@mcg1969
Copy link
Collaborator

mcg1969 commented Sep 7, 2020

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
Copy link
Collaborator

mcg1969 commented Sep 7, 2020

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
Copy link
Collaborator

mcg1969 commented Sep 7, 2020

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

@mcg1969
Copy link
Collaborator

mcg1969 commented Sep 8, 2020

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

@fcollonval
Copy link
Contributor

@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.

@mcg1969
Copy link
Collaborator

mcg1969 commented Sep 8, 2020

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

@mcg1969
Copy link
Collaborator

mcg1969 commented Mar 6, 2024

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

@mcg1969 mcg1969 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants