Anaconda 2016

From HPC users
Jump to navigationJump to search

Introduction

Conda is an open source package management system and environment management which can quickly install, run and update packages and their dependencies (see also https://conda.io/docs/). Conda is maintained by Continuum Analytics. Conda lets you find and install packages. You can use Anaconda to quickly install software in your $HOME-directory in case it is not installed already (i.e. you need a specific version).

Installed Version

hpc-uniol-env
Anaconda3/4.3.0 (based on conda/4.3.8)
hpc-env/6.4
Anaconda3/5.1.0 (based on conda 4.5.5)

Using Anaconda

Prerequisites

To work with Anaconda, you have to enable the required modules first.

module load hpc-uniol-env
module load Anaconda3

Not you can start working with the conda commands.

Creating Environments and Installing Packages

To keep your programs isolated, you should create separate environments for each application. It is not advisable to put programs into your base environment, which is the default one named 'base'.

To create a new environment and install a package, type in

conda create --name <environment_name> <package_name>

Subsequent, you must activate the new environment by typing:

source activate <environment_name>

From now on, every conda command will only affect the activated environment until it gets deactivated again.

source deactivate <environment_name>

To see a list of all your environments, type:

conda info --envs

The active environment is marked with an asterisk (*).

To remove one of the environments, type in:

conda remove --name <environment_name> --all

Different Versions

When you create a new environment, conda installs the same Python version which had been installed when Anaconda was installed. If you want to use a different version, you can create a new environment and specify the version of Python that you want. E.g.:

conda create --name <environment_name> python=3.5

In this example, Python should show 3.5 as the installed version:

python --version

Finding and Installing Software

If you want to find out whether you have a specific package installed, or if so, which version is installed, you can do this using the search function within the individual environments. Just type in

conda search <package_name>

and you will get a list of all the applying packages available from the Anaconda repository. If there is an asterisk in front of one of the displayed version numbers, this indicates that this version is already installed. To install one of the shown packages, just type in

conda install <package_name>

If you just want to get a short list of every single installed program in the environment, type in

conda list

Quick Example

Further on, we will show you how to set up an environment including a package and a specific version of Python, based on the instructions above.

Loading the module:

module load Anaconda3

Creating the environment bio including the program Biopython with Python 3.5

conda create --name bio biopython python=3.5
Proceed ([y]/n)? y

Activating your new environment:

source activate bio

Starting Python and checking Biopython:

python
import Bio

If that gives no error, Biopython is working and you're good to go.