Texas Tech University

Installing a local copy of Python

This tutorial will cover how to install Anaconda for Python 2 or Python 3 to your HPCC account. This will allow you to easily install new Python versions or packages other than those maintained by HPCC Staff. Installing Python to your $HOME directory should be done once for every cluster you will be using it on. As such, you will want to install a separate copy of Anaconda/Python for Hrothgar and Quanah. The instructions to perform this installation can be found below.

Table of Contents:

  1. Installing on Quanah
  2. Installing on Hrothgar
  3. Installing Python Packages

 

Installing on Quanah

The following commands can be used to install Python 2 or Python 3 in your $HOME directory.

#Go to your home directory
cd $HOME
#Make and enter quanah.local
mkdir quanah.local
cd quanah.local
#Visit https://www.continuum.io/downloads#linux 
# in order to download the latest version of
# Anaconda2 or Anaconda3.
# As of writing this would be version v4.4.0
wget https://repo.continuum.io/archive/Anaconda3-4.4.0-Linux-x86_64.sh #Anaconda3
wget https://repo.continuum.io/archive/Anaconda2-4.4.0-Linux-x86_64.sh #Anaconda2
#Install Anaconda - Most defaults except those noted below are fine.
# When prompted for the install location, specify the following:
# Anaconda2: ~/quanah.local/anaconda2
# Anaconda3: ~/quanah.local/anaconda3
#
# We suggest not letting it add to your .bashrc as doing so will make it difficult change versions.
bash Anaconda3-4.4.0-Linux-x86_64.sh #Anaconda3
bash Anaconda2-4.4.0-Linux-x86_64.sh #Anaconda2
#Add Anaconda/Python to your PATH
# You will likely want to do this as part
# of every quanah submission script you
# use that references Python3/Python2.
export PATH="$HOME/quanah.local/anaconda3/bin:$PATH" #Anaconda3
export PATH="$HOME/quanah.local/anaconda2/bin:$PATH" #Anaconda2
#Make sure the correct pip is being used
which pip #Anaconda3: Expected output: ~/quanah.local/anaconda3/bin/pip
which pip #Anaconda2: Expected output: ~/quanah.local/anaconda2/bin/pip


 

Installing on Hrothgar

The following commands can be used to install Python 2 or Python 3 in your $HOME directory.

#Go to your home directory
cd $HOME
#Make and enter hrothgar.local
mkdir hrothgar.local
cd hrothgar.local

#Visit https://www.continuum.io/downloads#linux
# In order to download the latest version of
# Anaconda2 or Anaconda3
# As of writing this would be version v4.4.0
wget https://repo.continuum.io/archive/Anaconda3-4.4.0-Linux-x86_64.sh #Anaconda3
wget https://repo.continuum.io/archive/Anaconda2-4.4.0-Linux-x86_64.sh #Anaconda2

#Install Anaconda - Most defaults except those noted below are fine.
# When prompted for the install location, specify the following:
# Anaconda2: ~/hrothgar.local/anaconda2
# Anaconda3: ~/hrothgar.local/anaconda3
#
# We suggest not letting it add to your .bashrc as doing so will make it difficult change versions.
bash Anaconda3-4.4.0-Linux-x86_64.sh #Anaconda3
bash Anaconda2-4.4.0-Linux-x86_64.sh #Anaconda2

#Add Anaconda/Python to your PATH
# You will likely want to do this as part
# of every hrothgar submission script you
# use that references Python3/Python2.
export PATH="$HOME/hrothgar.local/anaconda3/bin:$PATH" #Anaconda3
export PATH="$HOME/hrothgar.local/anaconda2/bin:$PATH" #Anaconda2

#Make sure the correct pip is being used
which pip #Anaconda3: Expected output: ~/hrothgar.local/anaconda3/bin/pip
which pip #Anaconda2: Expected output: ~/hrothgar.local/anaconda2/bin/pip


 

 

Installing Python Packages

Using the Anaconda installer comes with the added benefit that it comes pre-loaded with a number of popular and powerful python packages, such as numpy and scipy.  However, you may find that you need additional packages to perform your research.  Anaconda makes installing many python packages easy with the use of the "conda install" command. For instance, if you needed to install the BioPython package (a popular package among bioinformaticians and biologists), you could use the following command:

conda install biopython

For a full list of packages that can be installed using "conda install" as well as a full list of packages that come pre-installed with Anaconda, please visit the Anaconda Package List.

High Performance Computing Center