Broken jupyter notebook kernel integration with conda environments
See original GitHub issueGreetings. I’m currently in a Jupyter kernel hell. I can’t figure how to fix it. And I’m not sure whether it’s a Jupyter or conda issue, so thanks for the patience!
Here’s my setup. I use conda to manage my python environments. I work on many different projects that use Jupyter notebooks, each project having its own environment (specified in environment.yml
files).
I recently reinstalled conda to update my root environment to Python 3.6 and conda 4.3.13. As part of this reinstallation, I tried to remove files that I thought would get freshly regenerated including jupyter configuration files (IIRC).
This reinstallation of conda triggered the issue:
- when I run
jupyter notebook
with the conda environment activated, the specific conda environment is not available in the spawned notebook browser. - If I run
python -m ipykernel.kernelspec
(I think) then I the activated conda environment becomes the defaultPython 3
kernel for all my notebook servers. - Creating new conda environments with
jupyter
installed does not add them to the list of kernels in jupyter.
Before I reinstalled conda (and deleted jupyter config directories since I wanted to freshly reinstall everything related to python):
- if I launched a notebook from an activated conda environment, the default
Python 3
kernel would correspond to that notebook - if I created a new conda environment, the kernel would show up as a choice in all jupyter sessions regardless of which environment
jupyter notebook
was running from - I never had to mess around with configuration files.
So I think I’ve broken something and I want the old (or any environment aware) behavior back. Tagging @minrk @jakevdp @kalefranz @asmeurer in case you or someone you mention can help. Will really appreciate any guidance!
Issue Analytics
- State:
- Created 7 years ago
- Reactions:15
- Comments:25 (2 by maintainers)
Top GitHub Comments
conda install nb_conda_kernels
failed with:So I installed
nb_conda_kernels
from conda-forge using:Now I can choose from my conda environments in the Jupyter kernel menu. Phew!
Note that the
nb_conda_kernels
README states:@takluyver, thanks for that info! It was enough for me to track down
nb_conda_kernels
(anaconda cloud, repo). Once I’m back at the affected machine, I’ll let you know if this fixes my issues.nb_conda
also looks interesting (allows you to manage conda environments in a Jupyter browser tab).In worst case, I should be able to use the single kernel installation commands you link to:
But I’m not a huge fan of this solution as it’s a manual step. Furthermore, when we have several people collaborating on a repo, we want them to all have the same kernel names for conda environments.