Installing applications and libraries with Conda

Anaconda Python uses a package management system called Conda which allows users to easily download and install a large range of Python, R and other packages and libraries into their own user directories, without having to use environment modules, follow complex installation instructions or to ask us for help.

As it uses the same package management system as Anaconda Python, it will also give you a Python 3 (or Python 2) environment without having to use the system
python and
python-libs modules.

How do I install it?
If you are using MARC1, as you have a 20GB HOME directory it is probably safe to install into this HOME directory.
On the other HPC clusters you have a HOME directory shared across the machines so we recommend that you install into a dedicated
/nobackupdirectory (eg.
/nobackup/<username>/conda2 for a Python2 Conda install).

It is also possible to create a shared Bioconda installation across (for example) a research group. Please contact us if you would like to discuss this further.

Installation instructions:

If you wish to confirm the download is valid, Miniconda provide a set of MD5 checksums for these installers. These are available linked from the Miniconda Homepage

2. Run the installer:

1

2

bash Miniconda3-latest-Linux-x86_64.sh

You will be prompted to agree to a set of licence terms (hit [SPACE] to page down) Enter yes when prompted to agree

3. Setting the install directory
Next, you will be prompted for an installation directory. By default this will be your home directory (here for user issev001):

1

2

3

4

5

6

7

8

9

Miniconda3 will now be installed into thislocation:

/home/marc1_d/issev001/miniconda3

-Press ENTER toconfirm the location

-Press CTRL-Ctoabort the installation

-Orspecifyadifferent location below

[/home/marc1_d/issmcal/miniconda3]&gt;&gt;&gt;

To accept this location, hit
[ENTER] or specify an alternative installation directory. For example, you may wish to install into your
/nobackup directory so just type the full path to this directory, for example (for user issev001):

Files on /nobackup are automatically deleted after 90 days if they have not been accessed. You will need to take steps to make sure that this directory is not expired.

4. Final steps
You will be prompted for the installer to add a line to your
~/.bashrc file. This will allow Conda to be automatically loaded (and thus all of it applications available) every time you log in:

1

2

3

Doyou wish the installer toprepend the Miniconda3 install location

toPATH inyour/home/marc1_d/issmcal/.bashrc?[yes|no]

[no]&gt;&gt;&gt;

Reply yes and hit
[ENTER]
The installer will finish. Logout and then back in again and the Conda environment is ready for use.

Configuring Conda

Before first use, the conda package management system needs some initial configuration.

Make sure all the components are updated to their latest versions by entering:

1

conda update conda

at the command prompt. If there are any updates, you will be prompted to agree their installation.

Add the a number of channels. This step is required so that the conda installer knows where to get the installation files for your applications from. Again, at the command prompt:

1

2

3

4

conda config--add channelsr

conda config--add channels bioconda

conda config--add channels conda-forge

That’s it. You can now use Conda to automatically install a range of applications and libraries.

Installing applications and libraries

A number of research domains have repositories that allow the installation of applications and libraries. One example is Bioconda for the Computational Biology community.

The full list of applications that Bioconda is currently able to install is available on the Bioconda Web site:

Installing Python packages

Creating environments with Conda

Environments can be though of as standalone, isolated working copies of Python and other packages. They are usually created for specific projects or tasks where a certain configuration is needed that is different than for other projects.

For example, to replicate a workflow used by another researcher in your team you might create an environment with specific applications and versions or you might have a particular part of your workflow that requires a package built for an older version of Python.

Environments can be created, switched on and switched off as required.

Example 1: Environment with older versions of packages

Create an environment with
bowtie2 version=2.2.5 and
bamhash version=1.0 :

1

conda create-nproject1 bowtie2=2.2.5

This creates the environment with the first of the packages, you will see the environment being built.

The next step is to activate this package:

1

source activate project1

The command prompt will change, with the name of the environment in parentheses before the regular prompt:

1

(project1)[issev001@login2.marc1~]$

This environment is isolated from the main Bioconda installation. You will need to install the specific applications and packages you need directly into this environment. In our case we still need to install bamhash.

1

conda install bamhash=1.0

You can continue to install packages into this environment and run your scripts and analyses as normal. All your drives, directories and files can be accessed as normal.

When you have finished working in the environment and want to return to the regular prompt and the main Bioconda system:

1

source deactivate

and the command prompt will return to normal:

1

[issev001@login2.marc1~]$

Example 2: Creating a Python 2 environment

Originally, we downloaded and installed Bioconda built around Python 3 (which is the version of Python we should now be using). Sometimes though, we need to work with a legacy Python 2 package (htseq is an example of a legacy Python 2 package) that has not been updated to work with Python 3, or we need to temporarily revert to Python 2 in order to collaborate with a colleague who has not made the transition.

In these cases, we can create a Python 2 environment:

1

conda create-nproject2 python=2.7

activate it as before:

1

source activate project2

and then install the packages we need:

1

conda install htseq

When finished using the environment, as before:

1

source deactivate

More environment commands
You can list all of the environments you currently have available: