Main.InstallingPackages History

Hide minor edits - Show changes to markup

April 14, 2010, at 03:00 PM MST by 10.84.44.72 -
Deleted line 0:
Added line 34:

More complete information is found in the Python documentation.

April 14, 2010, at 02:59 PM MST by 10.84.44.72 -
Added lines 1-3:

Installing Python packages

April 14, 2010, at 02:59 PM MST by 10.84.44.72 -
Deleted line 0:
Changed line 20 from:

- python setup.py build

to:
  • python setup.py build
Changed line 24 from:

- sudo python setup.py install

to:
  • sudo python setup.py install
April 14, 2010, at 02:58 PM MST by 10.84.44.72 -
Added lines 1-32:

The following are generic instructions for installing a python package that is provided as source-code.

For concreteness we will illustrate this process for the biopython package. A package that is provided as source-code is typically named something like

biopython-1.54b.tar.gz or biopython-1.54b.zip

depending on which program was used to package the package. The first part of the name is the package name, followed by its version (the b in this case stands for "beta"). First move the source code to your directory of choice. Depending on the extension use an appropriate program to "unpack" the contents of the package (tar -xzf for files with the extension ".tar.gz" and unzip for zip files).

Let's look inside the directory.

The most important file there is called "setup.py". This file is used to perform the installation process. Which is composed two steps:

- python setup.py build

  This "builds" the package, which may include compilation if the package contains c/c++ code.
  On OS-X you will need Apple's Xcode (usually bundled on your OS install disk).

- sudo python setup.py install

  This installs the package in one of the standard locations where python packages are
  installed in your system.  This typically requires root access, which is why the sudo
  command is used.

Some packages (like biopython) provide the option of testing that everything works correctly by running: python setup.py test