Understanding conda and pip
conda | pip | |
---|---|---|
Package distribution format | Binaries | Wheels or source |
Requires compilers? | No | Yes |
Package types | Any (Python, R, C++, and so on) | Python only |
Environment creation? | Yes, built in | No, requires virtualenv or venv |
Dependency resolution? | Yes | No |
Package sources | Anaconda repo, Anaconda.org | PyPI |
environment.yml
file manuallyenvironment.yml
file and then building an environment from that file. Although this method is more time consuming to set up, it offers several advantages:
.yml
fileenvironment.yml
fileenvironment.yml
file. When writing the file, be sure to add pip and its dependencies last, since conda builds environments in the order listed.
environment.yml
fileenvironment.yml
file, run the following command from the directory containing the file:
environment.yml
fileenvironment.yml
file, then rebuild the environment by running the following command from the directory containing the file:
--prune
option removes any orphaned packages from the environment. A package is considered orphaned if it meets both these criteria:pip install
in a conda environmentpip install
in your base environment. Create a separate conda environment to isolate changes.