Jupyter notebook installing pip packages into wrong conda environment

Thanks for any help / info on this:

I have several conda environments, each with ipykernel installed and visibly available as kernel choices in jupyter notebook.

The notebook I ran runs fine, pip packages get installed and it completes with no errors.

The problem is that I’m trying to avoid intermingling packages from one notebook to others, so I have multiple conda environments and multiple kernels related to those environments.

structure:

  • I am starting the jupyter notebook server from within the activated BASE conda environment.
  • I am selecting “dev” as my python kernel
  • I have a “dev” conda environment that has ipykernel installed

Problem:

  • ran the notebook, using the selected “dev” kernel
  • the pip packages got installed into “BASE” conda environment and not “DEV”…

So I’ve officially mangled my setup.. exactly what I was trying to avoid…

Expected behavior:

  • pip packages should be installed into the conda environment that is attached to the kernel that is selected in jupyter notebook (right??)

  • the pip packages should be installed into “DEV” conda environment since this is the kernel I have selected…

Am I missing something? Do the packages only get installed into the conda environment where I start the jupyter server?

Thanks!

Read more here: Source link