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
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 /nobackup directory (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.
1. Download the Miniconda installer
At a command prompt, enter:
2. Run the installer:
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):
Miniconda3 will now be installed into this location:
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
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):
[/home/marc1_d/issmcal/miniconda3] >>> /nobackup/issev001/miniconda3
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:
Do you wish the installer to prepend the Miniconda3 install location
to PATH in your /home/marc1_d/issmcal/.bashrc ? [yes|no]
Reply yes and hit [ENTER]
The installer will finish. Logout and then back in again and the Conda environment is ready for use.
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:
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:
conda config --add channels r
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:
conda create -n project1 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:
source activate project1
The command prompt will change, with the name of the environment in parentheses before the regular prompt:
(project1) [firstname.lastname@example.org ~]$
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.
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:
and the command prompt will return to normal:
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:
conda create -n project2 python=2.7
activate it as before:
source activate project2
and then install the packages we need:
conda install htseq
When finished using the environment, as before:
More environment commands
You can list all of the environments you currently have available:
conda info --envs
and delete an environment you no longer need:
conda remove --name