1

There are a lot of questions related to this on SO, however all the answers appear not to work for me.

The problem:

I have a conda environment, called rideaux. I wish to access this enviroment from my jupyter notebooks. However, in jupyter notebooks the only kernel available is the default one.

enter image description here

To test, I tried to import packages that are available in the conda environment, but as expected this does not work in the available kernel.

What I tried:

As per related questions and answers (and more not listed here).

  1. First, I tried to simply run the jupyter notebook server from inside the rideaux enviroment. This returns no change from the image above, i.e., the rideaux kernel is not available.

  2. Next, I tried to use the nb_conda_kernels package. I installed conda install -n notebook_env nb_conda_kernels in my base environment and in my rideaux environment. I also installed ipykernel in my rideaux environment conda install ipykernel. Then, started a notebook server from the rideaux environment resulted in no change from the image above.

  3. I tried to register the conda environment by running ipython kernel install --user --name=rideaux while inside the rideaux environment. This resulted in no change.

General information and troubleshooting.

Running which jupyter within the rideaux environment returns a executable from inside the environment.

Running jupyter kernelspec list returns the following. Here python3 appears to be the one seen in the image above. Then why does the rideaux kernel not show up?

Available kernels:
  rideaux    /home/mjpvanzuijlen/.local/share/jupyter/kernels/rideaux
  python3    /home/mjpvanzuijlen/anaconda3/envs/rideaux/share/jupyter/kernels/python3

Running !jupyter-troubleshoot inside the notebook returns the output below. Nowhere does it mention the rideaux environment and the one returned by which jupyter is also not visible here. This might mean the wrong jupyter is being ran? I am not sure.

$PATH:
    /snap/jupyter/6/bin
    /snap/jupyter/6/usr/sbin
    /snap/jupyter/6/usr/bin
    /snap/jupyter/6/sbin
    /snap/jupyter/6/bin
    /home/mjpvanzuijlen/snap/jupyter/common/bin
    /usr/local/sbin
    /usr/local/bin
    /usr/sbin
    /usr/bin
    /sbin
    /bin
    /usr/games
    /usr/local/games

sys.path:
    /snap/jupyter/6/bin
    /snap/jupyter/6/lib/python37.zip
    /snap/jupyter/6/lib/python3.7
    /snap/jupyter/6/lib/python3.7/lib-dynload
    /snap/jupyter/6/lib/python3.7/site-packages

sys.executable:
    /snap/jupyter/6/bin/python3.7

sys.version:
    3.7.3 | packaged by conda-forge | (default, Mar 27 2019, 23:01:00) 
    [GCC 7.3.0]

platform.platform():
    Linux-4.15.0-140-generic-x86_64-with-glibc2.10

which -a jupyter:
    /snap/jupyter/6/bin/jupyter
    /snap/jupyter/6/bin/jupyter
Mitchell van Zuylen
  • 3,905
  • 4
  • 27
  • 64
  • Install `nb_conda_kernels` and `jupyter` in one environment, and always launch `jupyter notebook` with that environment active (sounds like your **base**). Kernel environments only need `ipykernel`. See [this answer](https://stackoverflow.com/a/43197286/570918); also [the `nb_conda_kernels` README](https://github.com/Anaconda-Platform/nb_conda_kernels#readme) is worth a read. – merv Sep 07 '21 at 16:46

0 Answers0