anaconda / nb_conda

Conda environment and package access extension from within Jupyter
BSD 3-Clause "New" or "Revised" License
140 stars 32 forks source link

nb_conda kernel does not pick up new packages from conda but from pip #54

Closed fabboe closed 7 years ago

fabboe commented 7 years ago

Hi all,

nb_conda is a great idea, thanks for that. I'm having a strange issue on a very fresh system.

After

sudo miniconda2/envs/py35data/bin/conda install matplotlib

The respective kernel of nb_conda does not have the package available. It also does not show it in the list of the conda tab. Same holds after restarting even the whole notebook server.

Whereas after

sudo miniconda2/envs/py35data/bin/pip install matplotlib

I'm able to import the package even in the running kernel of py35data. Though the nb_conda tab still doesn't show it.

The kernel definition (which nb_conda generated?) in miniconda2/envs/py35data/share/jupyter/kernels/python3/kernel.json seems pretty generic:

{
 "display_name": "Python 3",
 "language": "python",
 "argv": [
  "python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ]
}

Am I expecting too much here from nb_conda? Why does it pick it up from pip and not from conda?

Thanks for reading, Fabian

damianavila commented 7 years ago

Is ipykernel package installed in the py35data environment?

fabboe commented 7 years ago

It is, as

ipykernel 4.6.1 py35_0

According to my tests that env wouldn't even be available as a kernel if ipykernel wouldn't be there. Actually I figured this issue out during those tests already. I had an env created without ipykernel and nb_conda didn't pick it up. Adding ipykernel to the env afterwards doesn't help (same issue as described above I guess).

I just confirmed with fiona but maybe found a hint to a different problem. There seems to be confusion of root and env conda manager. Is this in the end a problem of conda / conda-env?

Note that it's not pointing to the env in the print statements.

➜  ~ sudo miniconda2/envs/py35data/bin/conda install fiona
Fetching package metadata .........
Solving package specifications: .

Package plan for installation in environment /Users/fabo/miniconda2:

The following NEW packages will be INSTALLED:
 ~ sudo miniconda2/envs/py35data/bin/conda list
# packages in environment at /Users/fabo/miniconda2:
#
...
fiona                     1.7.0                    py27_0

And indeed I can find fiona files only in the root env, not in the py35data env.

Do you confirm that's conda / conda-env problem? Maybe you still have a hint where I should go to debug further. We can close this one probably.

Thanks!

fabboe commented 7 years ago

Closing this. Reproduced in an env with no relation to nb_conda whatsoever. Issue with conda/$PATH it seems.

mmarchetti commented 7 years ago

Conda expects a -n or -p option to specify the install env. It's not based on the location of the conda executable you run.

fabboe commented 7 years ago

That's it, thanks! I was sure that I had used the other behaviour in past versions successfully before.