Getting started with Conda

Conda is an open source cross-platform package and environment manager from Anaconda.

Package manager

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 list.

Environment manager

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 source deactivate.

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.

anaconda-navigator

Anaconda navigator interface

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 channels

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.

One thought on “Getting started with Conda

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s