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

PyCharm is not able to run jupyter with error no such kernel named python3 #936

Closed
MordicusEtCubitus opened this Issue Jul 24, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@MordicusEtCubitus

MordicusEtCubitus commented Jul 24, 2016

I have this issue with pycharm 2016.2 and Anaconda 3.4
It is discussed here: http://stackoverflow.com/questions/38257138/jupyter-no-such-kernel-named-python3

I've investigated this a bit, and apparently there is 2 possible reasons

  • An error in PyCharm which uses default NATIVE_KERNEL_NAME (python3) but Anaconda replace it by "Python [Root]"
  • In Anaconda which removes default NATIVE_KERNEL_NAME with no good reason and in a bad way, as I think it should just update it

For a longer explanation: Anaconda provides its own manager class CondaKernelSpecManager
in file lib/python3.5/site-packages/nb_conda_kernels/manager.py

In its "get_kernel_spec(self, kernel_name)" it tries to find provided kernel name in conda environments
If not it calls super(CondaKernelSpecManager, self).get_kernel_spec(kernel_name)
But this one calls "find_kernel_specs" which is overrided in conda manager, so calls finally conda's method, which removes NATIVE_KERNEL_NAME from spec list

I don't see the need to remove natives names, especially if they are not duplicated with conda environements.
More, if conda env as same name than native, an update is just enough
So I suggest this work around:

def find_kernel_specs(self):
    """Returns a dict mapping kernel names to resource directories.

    The update process also add the resource dir for the conda
    environments.
    """
    kspecs = super(CondaKernelSpecManager, self).find_kernel_specs()

    # COMMENT THIS
    # remove native kernels because it is provided by the env name
    # if "python3" in kspecs:
    #     kspecs.pop("python3")
    # elif "python2" in kspecs:
    #     kspecs.pop("python2")
    # elif "R" in kspecs:
    #     kspecs.pop("R")
@bollwyvl

This comment has been minimized.

Show comment
Hide comment
@bollwyvl

bollwyvl Aug 1, 2016

@MordicusEtCubitus We've released versions of nb_conda, nb_conda_kernels and nb_anacondacloud through the official Anaconda conda repos that should resolve the issues you are seeing!

conda update nb_conda nb_conda_kernels nb_anacondacloud

As-installed kernel names that are eligible for being default (e.g. python2, python3, ir, etc.) will be maintained unmodified, so they should always appear there.

The downside is as many as three options for the current env, i.e. if you are in root, you will see Python 2 and Python [root] and Python [default], you can now reproducibly capture which environment your kernel should run against.

meta: Anaconda-Platform/anaconda-nb-extensions#166

bollwyvl commented Aug 1, 2016

@MordicusEtCubitus We've released versions of nb_conda, nb_conda_kernels and nb_anacondacloud through the official Anaconda conda repos that should resolve the issues you are seeing!

conda update nb_conda nb_conda_kernels nb_anacondacloud

As-installed kernel names that are eligible for being default (e.g. python2, python3, ir, etc.) will be maintained unmodified, so they should always appear there.

The downside is as many as three options for the current env, i.e. if you are in root, you will see Python 2 and Python [root] and Python [default], you can now reproducibly capture which environment your kernel should run against.

meta: Anaconda-Platform/anaconda-nb-extensions#166

@MordicusEtCubitus

This comment has been minimized.

Show comment
Hide comment
@MordicusEtCubitus

MordicusEtCubitus Aug 1, 2016

Thanks a lot, I confirm that solves the issue I was facing.

MordicusEtCubitus commented Aug 1, 2016

Thanks a lot, I confirm that solves the issue I was facing.

@csoja csoja closed this Aug 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment