Conda is an open source cross-platform package and environment manager from Anaconda.
If you’re familiar with MacOSX then you’ve probably already used package managers like Homebrew or MacPorts that allow you to either download binaries or build code from source to easily install software. Conda is similar in that it also allows you to install packages using
conda install [pakage_name]. What’s really nice about Conda is that it’s also open source, language agnostic and cross-platform.
With Conda you can install packages from anaconda.org using the given package URL or using
conda install. If the package isn’t available from Conda then just use
pip install. Pip is the standard python tool for installing packages but unlike Conda it cannot manage environments or update Python.
To check what packages are installed use
Conda is also useful for creating and managing environments. Virtual environments are useful for preventing problems arising from dependency, version and sometimes permission conflicts. One example is Virtualenv which allows you to create isolated python environments. Like Virtualenv, Conda is also an environment manager. Creating a new environment is as easy as typing
conda create --name [name_of_environment] [dependencies] [packages]. To enter the environment you need to source it using
source activate [name_of_environment] and to exit the environment simply type
To check all the environments available, run
conda info --envs.
Quick guide to getting started
This 30 minute tutorial is helpful for getting started with Conda. There’s no need to memorise all the commands thanks to this handy conda cheat sheet.
There is also a graphical user interface (see above) which can be launched using the
anaconda-navigator command. You can view all the applications that form part of a particular environment (“Applications on” dropdown menu) and even launch or install applications. There is documentation listed under Learning and links to appropriate communities to join.
Conda-forge provides a collection of recipes, build infrastructure and distributions for the conda package manager. It is an additional channel from which packages may be installed.
To install a package specifically from the conda-forge channel simply use:
conda install -c conda-forge packagename.
Alternatively, the channel can be added to conda’s channel list using
conda config --add channels conda-forge or it can be appended (lower priority) using
conda config --append channels conda-forge.
Removing the channel is equally simple:
conda config --remove channels conda-forge.
2 thoughts on “Getting started with Conda”