The conda command is the primary interface for managing installations of various packages. It can query and search the package index and current installation, create new environments, and install and update packages into existing conda environments.
conda is an application for finding and installing software packages. A conda package is a binary tarball containing system-level libraries, Python modules, executable programs, or other components. conda keeps track of dependencies between packages and platform specifics, making it simple to create working environments from different sets of packages.
A conda environment is a filesystem directory that contains a specific collection of conda packages. As a concrete example, you might want to have one environment that provides NumPy 1.7, and another environment that provides NumPy 1.6 for legacy testing. conda makes this kind of mixing and matching easy. To begin using an environment, simply set your PATH variable to point to its bin directory.
Conda packages are downloaded from remote channels, which are simply URLs to directories containing conda packages. The conda command starts with a default set of channels to search, but users may exert control over this list; for example, if they wish to maintain a private or internal channel (see Configuration for details).
To view all available packages, you can use conda search. See the search command examples for more information.
Once a conda package has been downloaded, it is said to be locally available. A locally available package that has been linked into an conda environment is said to be linked. Conversely, unlinking a package from an environment causes it to be unlinked.
Since conda environments are simply directories, they may be created anywhere. However, conda has a notion of locations which are also simply directories that are known to conda, and contain environments within. Conda environments created in such locations are said to be known, and can be displayed for easy reference. Conda has a default system location, but additional locations may be specified (see Directory Structure and Configuration, respectively, for more details).
Names and versions of software packages do not follow any prescribed rules. However, in order to facilitate communication and documentation, conda employs the following naming conventions with respect to packages:
These components are illustrated in the following figure:
Additionally, a package specification is a package name, together with a package version (which may be partial or absent), joined by “=”. Here are some examples:
In usage documentation, these will be referred to by package_spec.
conda also provides the notion of meta-packages. A meta-package is a conda package that contains a list of explicit packages to install without any further dependency checking. When installing a meta-package, its listed packages override and will replace any existing package versions that may already be installed in an conda environment. When creating, updating, or installing into environments, only one meta-package may be specified, and no additional packages may be specified.
The conda system has the following directory structure:
The directory that Anaconda (or Miniconda) was installed into; for example, /opt/Anaconda or C:\Anaconda
Other conda environments usually contain the same subdirectories as the default environment.
Anaconda supports Python 2.6, 2.7 & 3.3. The default is Python 2.7.
To get started, you need to create an environment using the conda create command.
$ conda create -n py33 python=3.3 anaconda
Here, ‘py33’ is the name of the environment to create, and ‘anaconda’ is the meta-package that includes all of the actual Python packages comprising the Anaconda distribution. When creating a new environment and installing the Anaconda meta-package, the NumPy and Python versions can be specified, e.g. numpy=1.7 or python=3.3.
$ conda create -n py26 python=2.6 anaconda
After the environment creation process completes, adjust your PATH variable to point to this directory. On Linux/MacOSX systems, this can be easily done using:
$ source activate <env name> # This command assumes ~/anaconda/bin/activate is the first 'activate' on your current PATH
This will modify your Bash PS1 to include the name of the environment.
$ source activate myenv (myenv)$
On Windows systems, you should change or set the PATH manually.
Now you’re ready to begin using the Python located in your created environment.
If you would like to deactivate this environment and revert your PATH to its previous state, use:
$ source deactivate