Set up Conda in a VM

Learn to set up an environment on the LRZ Compute Cloud: create an instance , install Anaconda and create a conda environment..

Conda allows users to create, maintain, and switch between multiple ‘environments’, each of which can contain different versions of the same tools. In one environment, for instance, researchers can use the newest version of a particular program; in another, they can run an older variant, perhaps to avoid a newly introduced idiosyncrasy. Users can even create workflows that require software tools that would otherwise conflict. And system administrators can create dedicated ‘software stacks’ that they can distribute to users with a single command.

Getting Started with Your First VM on the LRZ Compute Cloud

Create an Account and Project

To access our cloud environment, you need a LRZ project that is enabled for the LRZ Compute Cloud service. More information on this subject can be found here.

Create an instance

To create your first VM, you just go through the tutorial: Create a VM.

Setting up the VM

After connecting to your VM, the next steps will consists in:

Run the following commands, which work for both Ubuntu and Debian, in the terminal:

$ sudo apt-get update
$ sudo apt-get install bzip2 git libxml2-dev


To install Anaconda distribution, run:

$ wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh 
$ bash Anaconda3-5.0.1-Linux-x86_64.sh 
$ rm Anaconda3-5.0.1-Linux-x86_64.sh 
$ logout

Connect again to your VM.

To verify that everything is installed properly, check your python version with python --version and verify that the right python is called by default with the command which python. You should be getting something similar to:

$ python --version
Python 3.6.3 :: Anaconda, Inc.
$ which python
/home/ubuntu/anaconda3/bin/python

Set up channels

Conda Channels are basically the locations where packages are stored. If there is a need of a package that is other than the defaults.

$ conda config --append channels conda-forge
$ conda config --append channels r
$ conda config --append channels bioconda

Create an environment

$ conda create -n my_env
$ source activate my_env

Install packages

$ conda install package_name

To transfer conda environments from one machine to another you have to install the conda-pack package.

(my_env) $ conda install conda-pack
(my_env) $ conda conda-pack my_env

*conda-pack will pack my_env into my_env.tar.gz