Anaconda

Anaconda is an environment manager similar to Python's virtual environment feature, but able to support user-specific installations for many more packages than just Python libraries. It is quite versatile but especially shines in quickly and easily configuring environments where you'll be using multiple different toolsets (R and Python, for instance) and need to set everything up in a cohesive fashion.


The following article will show you how to install Anaconda --specifically a lightweight version called miniconda -- to your home directory. You do not need sudo for these steps and can perform them without administrator privileges.

Installation

Broadly, we will be following the guide from the Anaconda website: https://conda.io/projects/conda/en/latest/user-guide/install/linux.html. If you're able to follow that guide on your own, you may do so; but if you're uncertain how to proceed then precise instructions are below.

  1. Identify the correct miniconda installer from https://docs.conda.io/en/latest/miniconda.html#linux-installers. We want a 64-bit Linux installer for the latest version of Python (conda lets you set up your environment with any version you want so older versions will also be available to you). In the provided screenshot we want the installer outlined in red, but as new installers are released you may want a different one.

2. We don't want to download the installer here though, we just want to copy the link to it. To do this you can right-click on the link and select "Copy link address" (your browser should have an analogous option if you don't see that exact wording).

3. Open a connection to SSRDE using SSH or puTTY. From here we're going to download that installer using the wget command. You should be able to type wget into the command line, paste in the URl that you copied, and hit Enter to initiate the download.

4. You can run the installer using the bash command as shown below:

5. Follow the installation instructions. The default miniconda location in your home directory is a good one, unless you're working with an SSCF representative and they direct you to choose another location, or you're certain you want it somewhere else.

At the end of the process the installer will ask if you want it to run conda init; you can answer "yes" to this, it will save you running that command manually.

6. You will be directed to close and reopen your SSRDE session for the installation to complete. When you do so you'll notice your command line looks a bit different. You now have a base conda environment set up that automatically activates when you log in. This behavior shouldn't be detrimental, but if you want to change it your SSCF representative can assist you in doing so. If you see the change in the way the command line looks, the installation is finished!

Using Anaconda

Environments

Anaconda is generally most useful for its environments feature. At it's simplest you want to create an environment with a name and a Python version (if you're using Python) for each project you run, so that each project has it's own libraries installed and they don't conflict with each other. The syntax to do this is conda create -n <NAME> python=<VERSION>, like so:

When you activate an environment, the text to the left of your username will change to indicate which environment you're using:

You can then install packages with conda so that you can use them in your jobs:

There's more information on working with virtual environments in the Python article. The syntax for Conda will be slightly different but the functionality is largely the same; for instance below is an example of how to generate a list of your currently installed packages in one conda environment, and how to install from that list in another library. This process is analogous to using pip freeze and pip install -r (the -y flag just agrees to any questions the command asks):

It's worth noting as well that you will need to activate your conda environments in your submission scripts in the same way you do with virtual environments; as shown in the Python article.

If you have any questions on working with conda, or have difficulty with these instructions, please contact your SSCF representative and we'll be glad to help!