1

There are many questions like this (e.g. Conda environments not showing up in Jupyter Notebook, Python: modul not found after Anaconda installation, https://askubuntu.com/questions/1271137/importing-anaconda-libraries-not-working). I have tried their solutions but to no avail.

In short, I have conda installed. I have installed jupyterlabs and nb_conda_kernels in my base environment. When I create a new conda env via a file, the environment is not listed in jupyter automatically. I can add it via

python -m ipykernel install --user --name <env-name>

but then after I restart jupyter and switch kernels, when I try to import a python module from it, it says module not found.

What do I need to do to fix this? I do not want to add jupyterlabs to every env.

NOTE:

  • when activating the env in the terminal the path is correct, e.g. /opt/anaconda/anaconda3/envs/<env-name>/bin
  • when using the env in the terminal, the pack is there.
  • when using the kernel in Jupyter, the module is not there.
SumNeuron
  • 4,850
  • 5
  • 39
  • 107
  • 1
    You don't mention installing `ipykernel` in the new environment - that must be done for the `nb_conda_kernels` package to auto-register the kernel. You should not have to manually register and what is possibly happening is you are registering some other Python, but just giving it a name that matches the environment. – merv Feb 26 '22 at 23:52
  • Could you add what `import sys; print(sys.path)` shows in a notebook running a kernel of interest? – merv Feb 26 '22 at 23:56

0 Answers0