Anaconda 2016

From HPC users
Revision as of 16:14, 19 September 2022 by Schwietzer (talk | contribs) (→‎Installed Versions)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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).
Conda is part of Anaconda3 as well as Miniconda3 which differ only in that Miniconda3 is provided without GUI and with no pre-installed packages.

Installed Versions

You can check for available versions with the spider command

module spider Anaconda3

These versions are installed and and currently available ...

... on envirnoment hpc-uniol-env:

  • Anaconda3/4.3.0
  • Anaconda3/2020.11
  • Anaconda3/2021.05
  • Anaconda3/2022.05
  • Miniconda3/4.9.2
  • Miniconda3/4.12.0

... on environment hpc-env/6.4:

  • Anaconda3/5.1.0
  • Anaconda3/5.3.0
  • Anaconda3/2019.10
  • Anaconda3/2020.11
  • Anaconda3/2021.05
  • Anaconda3/2022.05
  • Miniconda3/4.9.2
  • Miniconda3/4.12.0

... on environment hpc-env/8.3:

  • Anaconda3/4.3.0
  • Anaconda3/2020.11
  • Anaconda3/2021.05
  • Anaconda3/2021.11
  • Anaconda3/2022.05
  • Miniconda3/4.9.2
  • Miniconda3/4.11.0
  • Miniconda3/4.12.0

For more detailed information about the particular packages, type in the whole version, e.g.:

module spider Anaconda3/2022.05

For the version in this example, which comes with conda v4.5.5, you would have to load the environment module hpc-env/6.4 first:

module load hpc-env/8.3
module load Anaconda3

Using Anaconda

Prerequisites

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

module load hpc-env/6.4
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:

conda activate <environment_name>

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

conda deactivate 

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 <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:

conda activate bio

Starting Python and checking Biopython:

python
import Bio

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


Please note that Biopython is also available as a stand-alone module. Therefore, you do not necessarily need Anaconda to use it.

Please also note that there is a website about Biopython, which contains an informative wiki as well.

https://biopython.org/