Rather than downloading and installing this software, you might want to consider using the Virtual Machine for this class, which already contains everything you need. Or, you can do your computing on the cloud by following the instructions in the section Amazon Web Services EC2 AMI.
It is assumed that you are on a Unix-like machine (e.g Linux or Mac OS X). For some flavors of Unix it is easy to download and install some of the required packages using apt-get (see Software available through apt-get), or your system’s package manager. Many Python packages can also be installed using easy_install (see Software available through easy_install).
If you must use a Windows PC, then you should download and install [VirtualBox] for Windows and then run the Virtual Machine for this class to provide a Linux environment. Alternatively you can use a linux machine in the cloud via Amazon Web Services EC2 AMI.
If you are using a Mac and want to install the necessary software, you also need to install Xcode developer tools, which includes necessary compilers and make, for example.
Some of this software may already be available on your machine. The which command in Unix will tell you if a command is found on your search path, e.g.:
$ which python
/usr/bin/python
tells me that when I type the python command it runs the program located in the file listed. Often executables are stored in directories named bin, which is short for binary, since they are often binary machine code files.
If which doesn’t print anything, or says something like:
$ which xyz
/usr/bin/which: no xyz in (/usr/bin:/usr/local/bin)
then the command cannot be found on the search path. So either the software is not installed or it has been installed in a directory that isn’t searched by the shell program (see Shells) when it tries to interpret your command. See PATH and other search paths for more information.
Often there is more than one version of software packages in use. Newer versions may have more features than older versions and perhaps even behave differently with respect to common features. For some of what we do it will be important to have a version that is sufficiently current.
For example, Python has changed dramatically in recent years. Everything we need (I think!) for this class can be found in Version 2.X.Y for any \(X \geq 4\).
Major changes were made to Python in going to Python 3.0, which has not been broadly adopted by the community yet (because much code would have to be rewritten). In this class we are not using Python 3.X. (See [Python-3.0-tutorial] for more information.)
To determine what version of software you have installed, often the command can be issued with the --version flag, e.g.:
$ python --version
Python 2.5.4
If the version of Python on your computer is older than 2.7.0 (see above), you should upgrade.
See http://www.python.org/download/ or consider the Enthought Python Distribution (EPD) or Anaconda CE described below.
On Mac OSX, you can often install gfortran and all the Python packages we’ll need using the SciPy Superpack.
You might consider installing EPD free
This includes a recent version of Python 2.X as well as many of the other Python packages listed below (IPython, NumPy, SciPy, matplotlib, mayavi).
EPD works well on Windows machines too.
Anaconda is a new collection of Python tools distributed by Continuum Analytics The “community edition” Anaconda CE is free and contains most of the tools we’ll be using, including IPython, NumPy, SciPy, matplotlib, and many others. The full Anaconda is also free for academic users.
The IPython shell is much nicer to use than the standard Python shell (see Shells and ipython). (Included in EPD, Anaconda, and the SciPy Superpack.)
Used for numerical computing in Python (see Numerics in Python). (Included in EPD, Anaconda, and the SciPy Superpack.)
Matlab-like plotting package for 1d and 2d plots in Python. (Included in EPD, Anaconda, and the SciPy Superpack.)
Documentation system used to create these class notes pages (see Sphinx documentation).
GNU fortran compiler (see Fortran).
You may already have this installed, try:
$ which gfortran
Message Passing Interface software for parallel computing (see MPI).
Some instructions for installing from source on a Mac can be found at here.
Linear Algebra Package, a standard library of highly optimized linear algebra subroutines. LAPack depends on the BLAS (Basic Linear Algebra Subroutines); it is distributed with a reference BLAS implementation, but more highly optimized BLAS are available for most systems.
On a recent Debian or Ubuntu Linux system, most of the software for this class can be installed through apt-get. To install, type the command:
$ sudo apt-get install PACKAGE
where the appropriate PACKAGE to install comes from the list below.
NOTE: You will only be able to do this on your own machine, the VM described at Virtual Machine for this class, or a computer on which you have super user privileges to install software in the sytsem files. (See sudo)
You can also install these packages using a graphical package manager such as Synaptic instead of apt-get. If you are able to install all of these packages, you do not need to install the Enthought Python Distribution.
Software | Package |
---|---|
Python | python |
IPython | ipython |
NumPy | python-numpy |
SciPy | python-scipy |
Matplotlib | python-matplotlib |
Python development files | python-dev |
Git | git |
Sphinx | python-sphinx |
gfortran | gfortran |
OpenMPI libraries | libopenmpi-dev |
OpenMPI executables | openmpi-bin |
LAPack | liblapack-dev |
Many of these packages depend on other packages; answer “yes” when apt-get asks you if you want to download them. Some of them, such as Python, are probably already installed on your system, in which case apt-get will tell you that they are already installed and do nothing.
The script below was used to install software on the Ubuntu VM:
# $UWHPSC/notes/install.sh # sudo apt-get update sudo apt-get upgrade sudo apt-get install xfce4 sudo apt-get install jockey-gtk sudo apt-get install xdm sudo apt-get install ipython sudo apt-get install python-numpy sudo apt-get install python-scipy sudo apt-get install python-matplotlib sudo apt-get install python-dev sudo apt-get install git sudo apt-get install python-sphinx sudo apt-get install gfortran sudo apt-get install openmpi-bin sudo apt-get install liblapack-dev sudo apt-get install thunar sudo apt-get install xfce4-terminal # some packages not installed on the VM # that you might want to add: sudo apt-get install gitk # to view git history sudo apt-get install xxdiff # to compare two files sudo apt-get install python-sympy # symbolic python sudo apt-get install imagemagick # so you can "display plot.png" sudo apt-get install python-setuptools # so easy_install is available sudo easy_install nose # unit testing framework sudo easy_install StarCluster # to help manage clusters on AWS
easy_install is a Python utility that can automatically download and install many Python packages. It is part of the Python setuptools package, available from http://pypi.python.org/pypi/setuptools, and requires Python to already be installed on your system. Once this package is installed, you can install Python packages on a Unix system by typing:
$ sudo easy_install PACKAGE
where the PACKAGE to install comes from the list below. Note that these packages are redundant with the ones available from apt-get; use apt-get if it’s available.
Software | Package |
---|---|
IPython | IPython[kernel,security] |
NumPy | numpy |
SciPy | scipy |
Matplotlib | matplotlib |
Mayavi | mayavi |
Git | git |
Sphinx | sphinx |
If these packages fail to build, you may need to install the Python headers.