How do I keep track of pip-installed packages in an Anaconda (Conda) environment?
conda-env now does this automatically (if pip was installed with conda).
You can see how this works by using the export tool used for migrating an environment:
conda env export -n <env-name> > environment.yml
The file will list both conda packages and pip packages:
name: stats
channels:
- javascript
dependencies:
- python=3.4
- bokeh=0.9.2
- numpy=1.9.*
- nodejs=0.10.*
- flask
- pip:
- Flask-Testing
If you're looking to follow through with exporting the environment, move environment.yml
to the new host machine and run:
conda env create -f path/to/environment.yml
conda
will only keep track of the packages it installed. And pip
will give you the packages that were either installed using the pip
installer itself or they used setuptools
in their setup.py
so conda build generated the egg information. So you have basically three options.
You can take the union of the
conda list
andpip freeze
and manage packages that were installed usingconda
(that show in theconda list
) with theconda
package manager and the ones that are installed withpip
(that show inpip freeze
but not inconda list
) withpip
.Install in your environment only the
python
,pip
anddistribute
packages and manage everything withpip
. (This is not that trivial if you're on Windows...)Build your own
conda
packages, and manage everything withconda
.
I would personally recommend the third option since it's very easy to build conda
packages. There is a git repository of example recipes on the continuum's github account. But it usually boils down to:
conda skeleton pypi PACKAGE
conda build PACKAGE
or just:
conda pipbuild PACKAGE
Also when you have built them once, you can upload them to https://binstar.org/ and just install from there.
Then you'll have everything managed using conda
.