Change notebook kernel

1,371 views
Skip to first unread message

Chris Calloway

unread,
Jul 16, 2016, 5:55:54 PM7/16/16
to Project Jupyter
I updated my (anaconda) jupyter and something changed. Jupyter Notebook no longer has a selection of Python 2 or 3 kernels (or other kernels I may have installed like R or Matlab). It has a selection of all my anaconda environments.

I have a notebook that was created with a kernel in one conda environment. But I want to run it in a different environment. When i start Jupyter Notebook in that new environment, and then run the notebook, it starts a kernel from the environment I created the notebook in, rather than the environment in which I started Jupyter Notebook.

I can see no way to change the kernel in which a notebook runs. Is there a way?

Cheers, Chris Calloway
Applications Analyst
UNC RENCI
(919) 599-3530

Chris Calloway

unread,
Jul 16, 2016, 6:12:03 PM7/16/16
to Project Jupyter
Nevermind. I found it. Kernel -> Change kernel. Duh.

Thomas Kluyver

unread,
Jul 16, 2016, 6:38:26 PM7/16/16
to Project Jupyter
I'm a bit annoyed that Anaconda has made this specific change, because now you get a different experience depending on whether you install Jupyter from Anaconda or by other means. Adding some extra features would be fine, but it sounds like this uses a different model of having multiple installed kernels.

Maybe we need to do what we've been putting off since we designed kernelspecs and properly integrate environments, so that Anaconda doesn't feel the need to stuff environments into the kernelspec mechanism.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/df3b468b-c2e8-49d5-95e9-b76a4da40263%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Calloway

unread,
Jul 17, 2016, 10:36:26 AM7/17/16
to Project Jupyter
Heh. This answers my other question I didn't ask. Is this feature a customization by Anaconda or is Jupyter smart enough to figure out conda envs? So yes, I too am not entirely thrilled that I'm not getting the same experience. Makes me want to reinstall everything from conda-forge.

Carol Willing

unread,
Jul 17, 2016, 10:50:37 AM7/17/16
to jup...@googlegroups.com
Hi Chris, There’s an open issue about this recent conda change: https://github.com/conda/conda/issues/3094

On Jul 17, 2016, at 9:36 AM, Chris Calloway <c...@unc.edu> wrote:

Heh. This answers my other question I didn't ask. Is this feature a customization by Anaconda or is Jupyter smart enough to figure out conda envs? So yes, I too am not entirely thrilled that I'm not getting the same experience. Makes me want to reinstall everything from conda-forge.

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
signature.asc

Damián Avila

unread,
Jul 17, 2016, 8:49:22 PM7/17/16
to jup...@googlegroups.com
Some answers:

>I updated my (anaconda) jupyter and something changed. Jupyter Notebook no longer has a selection of Python 2 or 3 kernels (or other kernels I may have installed like R or Matlab). It has a selection of all my anaconda environments.

Yep, that is the nb_conda_kernels extension working. 
Can you please confirm that you are not seeing any of the other pre-existing kernels available in addition to the anaconda environments?

A little bit of explanations: nb_conda_kernels is actually creating kernelspecs on the fly for each conda environment where you have jupyter installed.

>I have a notebook that was created with a kernel in one conda environment. But I want to run it in a different environment. When i start Jupyter Notebook in that new environment, and then run the notebook, it starts a kernel from the environment I created the notebook in, rather than the environment in which I started Jupyter Notebook.
I can see no way to change the kernel in which a notebook runs. Is there a way?

The main idea behind nb_conda_kernels is being able to start a notebook server and quickly change between conda environments without killing the notebook sever, changing the environment and starting the notebook server again. You JUST select the "environment" from the Kernel menu and you are done, you are ready to work in that environment in just one step. 

>I'm a bit annoyed that Anaconda has made this specific change, because now you get a different experience depending on whether you install Jupyter from Anaconda or by other means. Adding some extra features would be fine, but it sounds like this uses a different model of having multiple installed kernels.

There was discussion about this and the final decision was to ship a set of extensions/nbextensions by default in Anaconda...in this way, the Anaconda users could have a better experience with an Anaconda-Jupyter integrated experience.

>Maybe we need to do what we've been putting off since we designed kernelspecs and properly integrate environments, so that Anaconda doesn't feel the need to stuff environments into the kernelspec mechanism.

That could be interesting... but from the Jupyter side, I am not sure if Jupyter should do that because it will bring us a lot of complexity derived from the fact that different "environment" mechanism exists and we will have to deal with all the upstream problems and diffrences that comes from those ones...

>Heh. This answers my other question I didn't ask. Is this feature a customization by Anaconda or is Jupyter smart enough to figure out conda envs? So yes, I too am not entirely thrilled that I'm not getting the same experience. Makes me want to reinstall everything from conda-forge.

You don't need to install everything from scratch... just conda remove nb_conda_kernels and you have the default experience.

Hope this info helps a little bit...

--
Damián

Nicholas Bollweg

unread,
Aug 1, 2016, 12:24:08 PM8/1/16
to Project Jupyter
@dancosta 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! @michaelpacer sorry for the delay!

```shell
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: https://github.com/Anaconda-Platform/anaconda-nb-extensions/issues/166
Reply all
Reply to author
Forward
0 new messages