skip to content
 

Anaconda (including conda) is installed on Linux desktop machines as an optional module. Use this instead of using pip with the distribution-supplied python within our desktop Ubuntu. There is a conda tutorial and a 'cheat sheet'.

As a simple test, use the following series of commands.

module load anaconda/python2/5.2.0
conda create -n test scipy

This installs the most recent versions of numpy and scipy into the conda environment test created above. These are usually newer package versions than those that come with Ubuntu.

Follow the steps given in the pages on managing environments to activate the new conda environment test. The command would be as follows.

conda activate test

If you're using an older version of conda (eg from anaconda 4.4.0) instead use

source activate test
Then you can start Python and import your new packages:
python -c "import scipy; print scipy.version.version"

 

Adding more packages

After the environment is created it's possible to add extra packages to it

conda install -n test flask

Conda-forge

As well as the long list of packages that come with the main Anaconda installation there is also a huge repository of useful 3rd party packages at Conda Forge. To install one of those packages pass '-c conda-forge' to 'conda install' to select the Conda Forge repository. For example

conda install -c conda-forge iris

This is the best way to get access to packages such as cfunits, esmp, orange, iris, iris-grib, eofs, pyke

Searching and installing specific versions

It's possible to search for packages on the different repositories:

conda search flask
conda search -c conda-forge flask

and then install a particular version

conda install -n test flask=0.12.2

What if the package I need isn't available for conda?

You can still run pip inside a conda environment to install other packages. The only problem with this is that it can make the environment difficult to reproduce, because conda can't manage pip packages. If you need to use pip within conda it's best to set up a new environment just for the project that needs pip, install all the conda packages you need first into that environment, and only then run pip to intall the missing ones. Keep a separate record of what packages you installed using pip because conda cannot track these.

Scripts

Start your scripts with

#!/usr/bin/env python

and they'll use the currently active conda environment not the system Python

Can't find what you're looking for?

Then you might find our A-Z site index useful. Or, you can search the site using the box at the top of the page, or by clicking here.