% This is the LaTeX file used to create the Biopython Installation
% documentation.
%
% If you just want to read the documentation, you can pick up ready-to-go 
% copies in both pdf and html format from:
%
% http://www.biopython.org/documentation/
%
% If you want to typeset the documentation, you'll need a standard TeX/LaTeX
% distribution (I use teTeX, which works great for me on unix platforms).
% Additionally, you need HeVeA (or at least hevea.sty), which can be
% found at:
%
% http://pauillac.inria.fr/~maranget/hevea/index.html
% 
% Once you've got everything, you should be able to generate pdf by running:
% 
% pdflatex Tutorial.tex  (to generate the first draft)
% pdflatex Tutorial.tex  (to get the cross references right)
% pdflatex Tutorial.tex  (to get the table of contents right) 
%
% To generate the html, you'll need HeVeA installed. First, remove the
% Tutorial.aux file generated by LaTeX, then run:
% 
% hevea Tutorial.tex   (to generate the first draft)
% hevea Tutorial.tex   (to get all of the references right)
%
% A Makefile is also provided which should help with the building
% process somewhat on UNIX-style systems.
%
% If you want to typeset this and have problems, please report them
% at biopython-dev@biopython.org, and we'll try to get things resolved. We 
% always love to have people interested in the documentation!

\documentclass{article}
\usepackage{url}
\usepackage{fullpage}
\usepackage{hevea}
\usepackage{graphicx}

% Make links between references
\usepackage{hyperref}
\newif\ifpdf
\ifx\pdfoutput\undefined
  \pdffalse
\else
  \pdfoutput=1
  \pdftrue
\fi
\ifpdf
  \hypersetup{colorlinks=true, hyperindex=true, citecolor=red, urlcolor=blue}
\fi

\begin{document}

\title{Biopython Installation}
\author{Brad Chapman (chapmanb@uga.edu)}

\maketitle
\tableofcontents

\section{Purpose and Assumptions}

This document describes installing Biopython on your computer. To make
things as simple as possible, it basically assumes you have nothing
related to Python or Biopython on your computer and want to end up with
a working installation of Biopython when you are finished following
through this documentation. 


Biopython should work on just any operating system where Python works,
so these instructions contain directions for installation on UNIX/Linux
, Windows and Macintosh machines. The directions assume 
that you have permission to install programs on the machine
(root access on UNIX and Administrator privileges on Windows or Mac
machines). While it is certainly possible to install things without
these privileges, this is a serious pain and all the tedious workarounds
aren't something that I'll go into very much in this documentation.

With all this said, hopefully these directions will make it
straightforward to get Biopython installed on your machine so you can
begin using it as quick as possible.

\section{Installing Python}

Python is a interpreting, interactive object-oriented programming
language and the home for all things python is
\ahrefurl{\url{http://www.python.org}}. Presumedly you have some idea of
python and what it can do if you are interested in Biopython, but if not
the python website contains tons of documentation and reasons to learn
to program in python.


Biopython is designed to work with Python 2.3 or later. With python, the
general rule of thumb is to keep yourself using the latest version, as
the development process is very clean and new releases are quite stable.
Upgrading bug-fix releases (for example. 2.3.1 to 2.3.2) 
is incredibly easy and won't require any re-installation of libraries.
Upgrading between versions (2.3 to 2.4) is more time consuming since you
need to re-install all libraries you have added to python.


Let's get started with installation on various platforms.

\subsection{Installation on UNIX systems and Mac OS X}

First, you should go the main python web site and head over to the information
page for the latest python release. At the time of this writing the
latest stable python release is 2.4, which is available from
\ahrefurl{\url{http://www.python.org/2.4/}}. This page contains links
to all released files for the given release. For UNIX, we'll want to use
the tarred and gzipped file, which is called \verb|Python-2.4.tgz| at
the time of this writing.

Download this file and then unpack it with the following commands:

\begin{verbatim}
$ gunzip Python-2.4.tgz 
$ tar -xvpf Python-2.4.tar 
\end{verbatim}

Then enter into the created directory:

\begin{verbatim}
$ cd Python-2.4
\end{verbatim}

Now, start the build process by configuring everything to your system:

\begin{verbatim}
$ ./configure
\end{verbatim}

Build all of the files with:

\begin{verbatim}
$ make
\end{verbatim}

Finally, you'll need to have root permissions on the system and then
install everything:

\begin{verbatim}
# make install
\end{verbatim}

If there were no errors and everything worked correctly, you should now
be able to type \verb|python| at a command prompt and enter into the
python interpreter:

\begin{verbatim}
$ python
Python 2.4 (#1, Dec  5 2004, 20:47:03)
[GCC 3.3.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
\end{verbatim}

\subsubsection{RPM and other Package Manager Installation}

There are a multitude of package manager systems out there for which
python is available. One popular one is the RPM (RedHat Package Manager)
system. Each of these package managing systems has its own quirks and
tricks and I certainly can't pretend to understand them all so I won't
try to describe them all here.


However, there is one general point which it is important to remember
when installing from any of these systems: you need to download and
install the development packages for python. A number of distributions
contain a "basic" python which contains libraries and enough stuff to
run simple python programs. However, they do not contain the python
libraries necessary to build third-party python applications (like
Biopython and it's dependencies). You'll need to install these libraries
and header files, which are often found in a separate package called
\verb|python-devel| or something similar. 

\subsection{Installation on Windows} 

Installation on Windows is most easily done using handy windows
installers. As described above in the UNIX section, you should go to the
webpage for the current stable version of Python to download this
installer. At the current time, you'd go to
\ahrefurl{\url{http://www.python.org/2.4/}} and download
\verb|Python-2.4.msi|. 


The installer is an executable program, so you only need to double click
it to run it. Then just follow the friendly instructions. On all newer Windows
machines you'll need to have Administrator privileges to do this
installation.

\subsection{Installation on older Macintoshes}

Mac OS X can readily compile the python distribution in the way
described above for UNIX systems, but earlier versions of the Macintosh
operating system aren't nearly as easy to work with. For these versions,
the best place to go is the Macintosh page on the python site:
\ahrefurl{\url{http://www.python.org/download/download_mac.html}}. This
site links to the MacPython pages, which contain installers for
Macintosh.


The Macintosh installer is as simple to use at the Windows installers.
You download the appropriate file (\verb|MacPython222active.bin| at the
current time), and then unpack it with StuffIt Expander. You then just
need to double click on the resulting graphical installer and follow the
easy instructions.

\section{Installing Biopython dependencies}

Once python is installed, the next step is getting the dependencies
for Biopython installed. Since not all functionality is included in the
main python installation, Biopython needs some support libraries to save
us a lot of work re-writing code that already exists. We try to keep
as few dependencies as possible to make installation as easy as
possible.

\subsection{mxTextTools}

This is the most important Biopython dependency as it is used
extensively in the internals of a number of parsers. You absolutely want
to install this if you want to get any sort of serious use out of
Biopython.


mxTextTools is available along with the entire mx-base system (which
contains a number of other useful utilities as well) and is available
for download at:
\ahrefurl{\url{http://www.lemburg.com/files/python/mxTextTools.html}}.

\subsubsection{UNIX and Mac OS X systems}

For UNIX and UNIX-like systems you should download the \verb|tar.gz|
file from the page listed above. At the current time, this is
\verb|egenix-mx-base-2.0.6.tar.gz|.

Once you download this, unpack it and change into the created directory:

\begin{verbatim}
$ gunzip egenix-mx-base-2.0.6.tar.gz 
$ tar -xvpf egenix-mx-base-2.0.6.tar
$ cd egenix-mx-base-2.0.6
\end{verbatim}

To build it, use the standard python build procedure:

\begin{verbatim}
$ python setup.py build
\end{verbatim}

Then become root, and install it, again using the standard python
mechanism:

\begin{verbatim}
$ python setup.py install
\end{verbatim}

\subsubsection{Windows systems}

For Windows operating systems, you should download the Windows installer
for the version of python you are running. At the current time, this
would be: \verb|egenix-mx-base-2.0.6.win32-py2.4.exe|.


This is a standard graphical installer, so after download double click
it and follow the instructions and it should install with no problem.
You'll have to have Administrator privileges to do this install, as with
python itself.

\subsubsection{Making sure it installed correctly}

If you've installed mxTextTools correctly, you should be able to fire up
your python interpreter and import it with no errors:

\begin{verbatim}
$ python
Python 2.4 (#1, Dec  5 2004, 20:47:03)
[GCC 3.3.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from mx import TextTools
>>>
\end{verbatim}

\subsection{Numerical Python}

The Numerical Python distribution (also known an Numeric or Numpy) is a
fast implementation of arrays and associated array functionality. This
is important for a number of Biopython modules that deal with
number processing. The main web site for Numeric is:
\ahrefurl{\url{http://sourceforge.net/projects/numpy}} and downloads are
available from:
\ahrefurl{\url{http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=1351}}.

\subsubsection{UNIX and Mac OS X systems}

As with mxTextTools, you should download the \verb|tar.gz| file. Version
23.8 of Numerical Python (\verb|Numeric-23.8.tar.gz|) compiles out of the box.
The build process is exactly the same as with mxTextTools:

\begin{verbatim}
$ gunzip Numeric-23.8.tar.gz 
$ tar -xvpf Numeric-23.8.tar
$ cd Numeric-23.8
$ python setup.py build
\end{verbatim}

Once it is built, you should become root, and then install it:

\begin{verbatim}
$ python setup.py install
\end{verbatim}


One important note if you use an RPM-based system and not installing
from source as described above: you need to also
install the Numeric header files which are not included with some
Numeric packages. As with the main python distribution, this means
you'll need to look for something like \verb|python-numeric-devel| 
and make sure to install this as well as the basic Numeric package.

\subsubsection{Windows systems}

Once again, Windows installers are available for Numeric so you should
follow the now-standard procedure of downloading the installer
(\verb|Numeric-23.8.win32-py2.4.exe| at the current time), double
clicking it and then following the installation instructions. As before,
you will need to have administrator permissions to do this.

\subsubsection{Making sure it installed correctly}

To make sure everything went okay during the install, fire up the python
interpreter and ensure you can import Numeric without any errors:

\begin{verbatim}
$ python
Python 2.4 (#1, Dec  5 2004, 20:47:03)
[GCC 3.3.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from Numeric import *
>>>
\end{verbatim}

\subsection{ReportLab (optional)}

The ReportLab package is a library for generating PDF documents. It is
used in the Biopython Graphics modules, which contains basic
functionality for drawing biological objects like chromosomes. If you
are not planning on using this, installing ReportLab is not necessary.
ReportLab in itself is very useful for a number of tasks besides just
Biopython, so you may want to check out
\ahrefurl{\url{http://www.reportlab.org}} before making your decision.


The main download page for ReportLab is
\ahrefurl{\url{http://www.reportlab.org/downloads.html}}. The ReportLab
company has some commercial products as well, but just scroll down their
page to the Open Source software section for the base ReportLab
downloads.

\subsubsection{UNIX and Mac OS X systems}

For UNIX installs, you should download the tarred and gzipped version of
the ReportLab distribution. At the time of this writing, this is called
\verb|ReportLab_1_20.tgz|. First, unpack the distribution and change
into the created directory:

\begin{verbatim}
$ gunzip ReportLab_1_20.tgz 
$ tar -xvpf ReportLab_1_20.tar
$ cd reportlab_1_20/
\end{verbatim}

Once again, ReportLab uses the standard python installation system which
you are probably feeling really comfortable with by now. So, first build
the package:

\begin{verbatim}
$ python setup.py build
\end{verbatim}

Now become root, and install it:

\begin{verbatim}
$ python setup.py install
\end{verbatim}

\subsubsection{Windows systems}

ReportLab does not have a graphical windows installer like the other
Biopython requirements. Luckily, it doesn't require any compilation
steps to work properly, so the installation is still quite easy. 


First, download the zipped distribution from the download site listed
above. At the current time this is called \verb|ReportLab_1_20.zip|. You
can also download the tarred/gzipped file (with a \verb|.tgz|
extension), but Windows handles zipped files better.


Secondly, unzip the downloaded file. WinZip is a common freely available
program for doing this
(\ahrefurl{\url{http://www.winzip.com/ddchomea.htm}}). The unzip process
should create a \verb|reportlab| directory.


Finally, drag the created \verb|reportlab| directory to the standard
directory for Python extensions. On current versions of python with a
standard installation this would be something like 
\verb|C:/Python24/Lib/site-packages|. All you have to do is drag it over
and you should be all set. Nice and easy.

\subsubsection{Making sure it installed correctly}

If reportlab is installed correctly, you should be able to do the
following:

\begin{verbatim}
$ python
Python 2.4 (#1, Dec  5 2004, 20:47:03)
[GCC 3.3.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from reportlab.graphics import renderPDF
>>>
\end{verbatim}

Depending on your version of python and what you have installed, you may
get the following warning message: 
\verb|Warn: Python Imaging Library not available|.  This isn't anything
to worry about since the Biopython parts that use ReportLab will work
just fine without it.

\subsection{Database Access (MySQLdb, ...) (optional)}

The MySQLdb package is a library for accessing MySQL databases. It is
used in the Biopython GFF module, which allows access to databases
created from GFF feature tables. Biopython also includes an accessory
module, DocSQL, which provides a convenient interface to MySQLdb. 
If you are not planning on using Bio.GFF or Bio.DocSQL, installing
MySQLdb is not necessary.


Additionally, both MySQLdb and psycopg (a PostgreSQL database adaptor)
can be used for accessing BioSQL databases through Biopython. Again if
you are not going to use BioSQL, there shouldn't be any need to install
these modules.


Installation instructions for MySQLdb and psycopg are included in the
BioSQL documentation, which is available from
\ahrefurl{\url{http://www.biopython.org/docs/biosql/python_biosql_basic.html}} and
\ahrefurl{\url{http://www.biopython.org/docs/biosql/python_biosql_basic.pdf}}.

\section{Installing Biopython}

\subsection{Obtaining Biopython
}
Biopython's internet home is at, naturally enough,  
\ahrefurl{\url{http://www.biopython.org}}. This is the home of all things 
Biopython, so it is the best place to start looking around. 
You have two choices for obtaining Biopython:

\begin{enumerate}

\item Release code -- We made available releases on the download page 
(\ahrefurl{\url{http://www.biopython.org/download/}}). 
The releases are also available both as source and as installers 
(windows installers right now), so you have some choices to pick from 
on releases if you prefer not to deal with source code directly.

\item CVS -- The current working copy of the Biopython sources is always
available via CVS (Concurrent Versions Systems --
\ahrefurl{\url{http://www.cvshome.org/}}). Concise instructions for
accessing this copy are available at
\ahrefurl{\url{http://cvs.biopython.org}}. CVS is normally quite stable
but there is always the caveat that the code there is under
development.

\end{enumerate}

Based on which way you choose, you'll need to follow one of the following installation options. Read on for the platform you are working on.

\subsection{Installing from source on UNIX and Mac OS X}
\label{sec:unix_install}

Biopython uses Distutils, the standard python installation package, for
its installation. If you read the install instructions above you are
already quite familiar with its workings. Distutils comes standard with 
Python 1.6 and beyond.

Now that we've got what we need, let's get into the installation:

\begin{enumerate}

\item First you need to unpack the distribution. If you got the CVS version, you are all set to go and can skip on ahead. Otherwise, you'll need to unpack it. On UN*X machines, a tar.gz package is provided, which you can unpack with \verb|tar -xzvpf biopython-X.X.tar.gz|. A zip file is also provided for other platforms.

\item Now that everything is unpacked, move into the \verb| biopython*| directory (this will just be \verb|biopython| for CVS users, and will be \verb|biopython-X.X| for those using a packaged download). 

\item Now you are ready for your one step install -- \verb|python setup.py install|. This performs the default install, and will put Biopython into the \verb|site-packages| directory of your python library tree (on my machine this is \verb|/usr/local/lib/python2.4/site-packages|). You will have to have permissions to write to this directory, so you'll need to have root access on the machine.

\begin{enumerate}

\item This install requires that you have the python source available. You can check this by looking for \verb|Python.h| and \verb|config.h| in some place like \verb|/usr/local/include/python2.4|. If you installed python with RPMs or 
some other packaging system, this means you'll also have to install the
header files. This requires installing the python development libraries
as well (normally called something like \verb|python-devel-2.4.rpm|).

\item The distutils setup process allows you to do some customization of your install so you don't have to stick everything in the default location (in case you don't have write permissions there, or just want to test Biopython out). You have quite a few choices, which are covered in detail in the distutils installation manual (\ahrefurl{\url{http://www.python.org/sigs/distutils-sig/doc/inst/inst.html}}), specifically in the Alternative installation section. For example, to install Biopython into your home directory, you need to type \verb|python setup.py install --home=$HOME|. This will install the package into someplace like \verb|$HOME/lib/python2.4/site-packages|. You'll need to subsequently modify the \verb|PYTHONPATH| environmental variable to include this directory so python will be able to find the installation.

\end{enumerate}

\item That's it! Biopython is installed. Wasn't that easy? Now let's check and make sure it worked properly. Skip on ahead to section~\ref{sec:is_working}.

\end{enumerate}

\subsubsection{Installation on FreeBSD}

Johann Visagie has been kind enough to create (and keep updated) a FreeBSD port of Biopython. Thanks to the wonders of the ports system, this means that all you need to do to install Biopython on FreeBSD is do the following as root:

\begin{verbatim}
# cd /usr/ports/biology/py-biopython
# make install
\end{verbatim}

And voila! It's installed. 


If you want more information on FreeBSD and things, Johann has written a nice primer for his FreeBSD EMBOSS port. This has lots of generally useful information, such as how to keep your ports tree up to date. If you are new to FreeBSD, you should definitely check it out at \ahrefurl{\url{ftp://ftp.no.embnet.org/pub/EMBOSS-extras/EMBOSS-FreeBSD-HOWTO.txt}}.

\subsection{Installing on UNIX systems using RPMs}

Warning. Right now we're not making RPMs for biopython (because I
stopped using an RPM system, basically). If anyone wants to pick this
up, or feels especially strongly that they'd like RPMs, please let us
know.

To simplify things for people running RPM-based systems, biopython can
also be installed via the RPM system. Additionally, this saves the 
necessity of having a C compiler to install biopython. 


Installing Biopython from a RPM package should be much the same process as used for other RPMs. If you need general information about how RPMs work, the best place to go is \ahrefurl{\url{http://www.rpm.org}}.


To install it, you should just need to do:

\begin{verbatim}
rpm -i your_biopython.rpm
\end{verbatim}

To see what you installed try doing \verb|rpm -qpl your_biopython.rpm| which will list all of the installed files.


RPMs do not install the documentation, tests, or example code, so you might want to also grab a source distribution, so you can use these resources (and also look at the source code if you want to).

\subsection{Installing with a Windows Installer}

Installing things on Windows with the installer should be really easy (hey, that's why they've got graphical installers, right?). You should just need to download the \verb|Biopython-version.exe| installer from biopython web site. Then you just need to double click and voila, a nice little installer will come up and you can stick the libraries where you need to. No need for a C compiler or anything fancy. You will need to have Administrator privileges on the machine to do the installation.


This does not install the documentation, tests, example code or source code, so it is probably also a good idea to download the zip file containing this so you can test your installation and learn how to use it.

\subsection{Installing from source on Windows}
\label{sec:windows_install}

This section deals with installing the source (i.~e.~from CVS or from a source zip file) on a Windows machine. Much of the information from the UNIX install applies here, so it would be good to read section~\ref{sec:unix_install} before starting. Also, a little warning -- I (Brad) am writing these instructions based on very limited experience with Windows; I am basically a UNIX geek. So if you know more about Windows and want to add/correct things in this section, please feel let us know!


I have successfully managed to use distutils to compile Biopython with Borland's free C++ compiler (available from \ahrefurl{\url{http://www.inprise.com/bcppbuilder/freecompiler/}}). It should also be possible with other Distutils supported compilers (please provide info if you've done this!).

\begin{enumerate}
  \item Borland C++ compiler

\begin{itemize}
  \item First you need to install and setup Borland C++. There are instructions on the Borland page and on the web, so you should follow these.
 
  \item Now you have to get python, which is compiled with a Microsoft compiler, able to live happily with Borland compiled extensions. Gordon Williams has an excellent page describing doing this (\ahrefurl{\url{http://www.cyberus.ca/~g_will/pyExtenDL.shtml}}), which is where I learned everything I know. Basically, what I did was run the Borland supplied tool \verb|COFF2OMF| on the python20.lib file:

\begin{verbatim}
> COFF2OMF python20.lib python20-borland.lib
\end{verbatim}

Then I just renamed \verb|python20.lib| to \verb|python20-orig.lib| and renamed \verb|python20-borland.lib| to \verb|python20.lib|, so that distutils will link against this ``Borland friendly'' python library.

  \item Now that that is ready, we are at the easy part -- using distutils to build it. All I did was:

\begin{verbatim}
> python setup.py build --compiler=bcpp
> python setup.py install
\end{verbatim}

and voila!, it's installed. 

\end{itemize}

\end{enumerate}

Now that you've got everything installed, skip on ahead to section~\ref{sec:is_working} to make sure everything worked.

\subsection{Installing on Macintosh}

This section describes installation on pre-OS X machines. On OS X
Biopython can be installed using the UNIX instructions.


Biopython code should work on Pre-OS X Macintoshes, using the MacPython distribution. I (Brad) am not a big Mac user, but have had good luck using several on the modules on the Macintosh.

\subsubsection{Pre-Built Install}

Yair Benita has been kind enough prepare pre-compiled and ready to go
binaries for Macintosh machines. These distributions also contain the
required Biopython libraries, so you can get everything installed all at
once. 


These builds are available from the Biopython download page at
\verb|.sit| files. You need to download this file and unpack it with
StuffIt Expander. This will create a \verb|MacBiopython-version|
directory. You then just need to drag the contents of this directory to
a standard location python searches (something like 
\verb|Macintosh HD::Python2.2::Lib::site-packages|) and it's all installed.

\subsubsection{Non Pre-Built Installation}

If you don't want to use the pre-built releases, you can get some basic
functionality from Biopython without compiling anything.
You need to download either the \verb|biopython-version.tar.gz| or \verb|biopython-version.zip| file from the download page, and unpack these. This can be done with tools such as Aladdin's Stuff-It expander. It will unpack into a directory called \verb|biopython-version|. If you open up this directory, you will find the main directory of modules, called \verb|Bio|. You should then open up your python installation (which should be in some place like \verb|Macintosh HD::Python2.2|) to the directory \verb|Lib::site-packages|, and copy the \verb|Bio| directory there by dragging it. Bam! You're done! By default, \verb|site-packages| is included in your \verb|PYTHONPATH|, so you should be ready to use it.


Some notes: Obviously this will not compile any of the C extensions in biopython. There are pure python implementations of all of these extensions, though, so you shouldn't need to worry about lack of functionality, only lack of speed. Jack Jansen (the MacPython god) has made patches to distutils which allow it to work on the Mac with the Metrowerks CodeWarrior compiler. I don't have this compiler (it costs money, oh no!), so I can't speak of how well it works. If anyone who codes more on the Mac has more information, I would be very happy to include it here.


\section{Making sure everything worked}
\label{sec:is_working}

First, we'll just do a quick test to make sure Biopython is installed correctly. The most important thing is that python can find the biopython installation. Biopython installs into top level \verb|Bio|, \verb|Martel| and \verb|BioSQL| directories, so you'll want to make sure these directories are located in a directory specified 
in your\verb| $PYTHONPATH| environmental variable. If you used the default install, this shouldn't be a problem, but if not, you'll need to set the \verb|PYTHONPATH| with something like \verb|export PYTHONPATH = $PYTHONPATH':/directory/where/you/put/Biopython'| (on UNIX). Now that we think we are ready, fire up your python interpreter and follow along with the following code:

\begin{verbatim}
$ python
Python 2.4 (#1, Dec  5 2004, 20:47:03)
[GCC 3.3.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from Bio.Seq import Seq
>>> from Bio.Alphabet.IUPAC import unambiguous_dna
>>> new_seq = Seq('GATCAGAAG', unambiguous_dna)
>>> new_seq[0:2]
Seq('GA', IUPACUnambiguousDNA())
>>> from Bio import Translate
>>> translator = Translate.unambiguous_dna_by_name["Standard"]
>>> translator.translate(new_seq)
Seq('DQK', HasStopCodon(IUPACProtein(), '*'))
>>>
\end{verbatim}

If this worked properly, then it looks like Biopython is in a happy place where python can find it, so now you might want to do some more rigorous tests. The \verb|Tests| directory inside the distribution contains a number of tests you can run to make sure all of the different parts of biopython are working. These should all work just by running \verb|python test_WhateverTheTestIs.py|. 


You can also run all of the tests using a nice graphical interface supplied by using PyUnit. To do this, you just need to be in the installation directory and type:

\begin{verbatim}
python setup.py test
\end{verbatim}

This should start up a Tk based graphical user interface (or default to the command line if you don't have Tkinter installed), which you can run the tests from. You can also run them by typing \verb|python run_tests.py| in the Tests directory.


If you've made it this far, you've gotten Biopython installed and running.
Congratulations!

\section{Notes for installing with non-administrator permissions}

Although I mentioned above that I wouldn't go much into installing in
non-root directories, if you are stuck installing
Biopython and it's dependencies into your home directory here are a
few notes and tricks to keep you going:

\begin{itemize}
  \item The Numeric package will take a little trickery to get it to be
    able to import. It will install a \verb|Numeric| directory and
    \verb|Numeric.pth| file into \verb|your_dir/lib/python|. The problem
    is that the \verb|Numeric.pth| file only works when located in the main
    python \verb|site-packages| directory. The solution, fortunately, is
    simple -- you need to make sure \verb|your_dir/lib/python| is in the
    \verb|PYTHONPATH| and then need to make a \verb|__init__.py| file in
    the \verb|Numeric| directory (an empty file or a file with just a
    comment is fine, as long as it exists). Then \verb|import Numeric|
    should work.

  \item Building some C modules, such as \verb|Bio.Cluster| require that 
    the Numeric include files (normally installed in
    \verb|your_dir/include/python/Numeric|) be available. If the
    compiler can't find these directories you'll normally get an error
    like:

    \begin{verbatim}
Bio/Cluster/clustermodule.c:2: Numeric/arrayobject.h: No such file or directory
    \end{verbatim}

    Followed by a long messy list of syntax errors. To fix this, you'll
    have to edit the \verb|setup.py| file to let it know where the
    include directories are located. Look for the line in
    \verb|setup.py| that looks like:

    \begin{verbatim}
    include_dirs=["Bio/Cluster"]
    \end{verbatim}

    and adjust it so that it includes the include directory where the
    numeric libraries were installed:
    
    \begin{verbatim}
    include_dirs=["Bio/Cluster", "your_dir/include/python"]
    \end{verbatim}

    Then you should be able to install everything happily.

\end{itemize}

Yes, it's a bit of a mess installing lots of packages in non-standard
locations. The best solution is to talk with your friendly system
administrator and get them to assist with the installation of at least
the required packages (they are generally quite useful for any python
install) before going ahead with Biopython installation.

\end{document}
