Please note: this project is inactive since early 2006

Installation Instructions

Author: Sébastien Bigaret <sbigaret@users.sourceforge.net>
Version: 975

Introduction

The framework depends on four other python packages, plus one or more python adaptors to connect to your database server. Additionally you'll need to have a running database server (either postgresql, mysql or oracle; sqlite does not need any server) --we do not cover here the installation of a database server, please refer to their respective documentation for installation details.

Unless explicitely stated, all installation can be made by unpacking their source distribution, cd-ing to the unpacked directory and then use the standard python package distutils with command-line like:

python ./setup.py install [--prefix=$HOME]

You can specify --prefix if you want to install the packages in an other location than the standard one.

This is what we will call Installation: standard distutils in the rest of this document.

Organization

This document is divided into two parts. The first one lists all required packages that needs to be installed. The second ones deals with python database adaptors, and you'll choose which one(s) you'll install depending on the database server you want to connect to.

Needed dependencies

Modeling Framework

The framework can be downloaded from http://modeling.sourceforge.net

Unless you already have Cheetah installed (it does not need to be installed before), you'll get the following message:

sh: cheetah-compile: command not found
Warning: compilation of cheetah templates failed: they may be absent, or cheetah-compile is not available.
=> Using the already compiled templates
Press ENTER to continue, CTRL-C to abort
  • if you're running python 2.1 or python2.2, you must install the appropriate version of Cheetah before continuing; the pre-compiled versions shipped with the framework are not compatible with cheetah versions running on py2.1/2.2.
  • otherwise, you can safely ignore the warning and press ENTER, installation will continue.

NotificationFramework v0.6

The NotificationFramework can be downloaded from https://sourceforge.net/projects/modeling/

Installation: standard distutils.

Cheetah Templates

  • If you're running python v2.1 or 2.2, you must use Cheetah v0.9.15
  • Otherwise, get the latest cheetah package (v2.0rc6 at the time I write this)

Get it here: http://www.cheetahtemplate.org/

Installation: standard distutils.

eGenix.com mx Extensions for Python v2.0.6

Download this from: http://www.egenix.com/files/python/eGenix-mx-Extensions.html#Download-mxBASE

Installation: standard distutils.

Note: wait until the end of the installation process before removing the directory; you may need it when installing a db-adaptor (such as psycopg for Postgresql).

spark v0.6.1

Spark homepage is at: http://pages.cpsc.ucalgary.ca/~aycock/spark/

Important: do NOT install v0.7+, it will not work, please use v0.6.1 which is at: http://pages.cpsc.ucalgary.ca/~aycock/spark/spark-0.6.1.tar.gz

Installation
Unpack the source distribution, then simply copy the file spark.py somewhere in your python path (for example, in /usr/lib/python2.x/site-packages/ or in your $HOME/lib/python2.x/site-packages/).

PyXML v0.8.4

Obtain your copy of PyXML at http://pyxml.sourceforge.net/

Installation: standard distutils.

Database specifics

The rest of the document addresses installation of specific python adaptors. You do not have to install all of them: simply choose at least one in the list of possible python adaptors for the database server you want to connect to.

MySQL

The only supported python db-adaptor is MySQL-python, currently v1.2.1

You'll find it at: http://sourceforge.net/projects/mysql-python

Installation: standard distutils.

Oracle

The only supported python db-adaptor is DCOracle2, currently v1.3beta.

You'll find it at: http://www.zope.org/Members/matt/dco2

Installation: see the INSTALL file distributed with DCOracle2.

Postgresql

Three python db-adaptors are supported, Either:

  • psycopg, at http://initd.org/software/psycopg

    Installation: psycopg uses the standard scheme ./configure && make. However, depending on your installation, you may need to specify where the C headers for postgresql and egenix-datetime are located. Example:

    ./configure --with-postgres-includes=/usr/include/postgresql \
                --with-mxdatetime-includes=/tmp/egenix-mx-base-2.0.5/mx/DateTime/mxDateTime \
               [--with-python=/usr/bin/python2.2]
     make
     cp psycopgmodule.so <somewhere in your $PYTHONPATH>
    

    (here the egenix extensions for Python where unpacked and installed from /tmp).

  • PyGreSQL: http://www.druid.net/pygresql/ The last release can be found at ftp://ftp.pygresql.org/pub/distrib/PyGreSQL.tgz

    Installation: standard distutils.

    Note 1:

    Depending on your installation, ./setup.py will or will not find the header file for postgresql. If it fails on lines like:

    gcc -g -O2 -Wall -Wstrict-prototypes -fPIC \
        -I/usr/include/pgsql -I/usr/local/include/python2.1 \
        -c pgmodule.c -o build/temp.linux-i686-2.1/pgmodule.o
    

    correct it by hand by including the correct include-path (with option -I. For example, on my machine, I need to change it to:

    gcc -g -O2 -Wall -Wstrict-prototypes -fPIC \
        -I/usr/include/postgresql -I/usr/include/postgresql/server 
        -I/usr/local/include/python2.1 \
        -c pgmodule.c -o build/temp.linux-i686-2.1/pgmodule.o
    

    Note 2:

    If you then get errors when using it, with errors like:

    _pg.error:ERROR:  Attribute "typprtlen" not found
    

    you need to patch pgdb.py, here is the patch:

    --- pgdb.ori.py Sun Aug 10 18:52:28 2003
    +++ pgdb.py     Sun Aug 10 18:52:35 2003
    @@ -147,7 +147,7 @@
                            return self.__type_cache[oid]
                    except:
                            self.__source.execute(
    -                               "SELECT typname, typprtlen, typlen "
    +                               "SELECT typname, typlen as typprtlen, typlen "
                                    "FROM pg_type WHERE oid = %s" % oid
                            )
                            res = self.__source.fetch(1)[0]
    

    (cf. http://archives.postgresql.org/pgsql-bugs/2003-01/msg00099.php)

  • pyPgSQL v2.4, which you can get at http://pypgsql.sourceforge.net/

    Installation: standard distutils.

SQLite

The only supported python db-adaptor is pysqlite, currently v0.5.1. Tested w/ SQLite database server v2.8.15

Get it at: http://pysqlite.sourceforge.net/

Installation: standard distutils.

Note:

Depending on your local installation, the standard setup.py may be unable to locate the header files for sqlite, and the libraries as well. If this is the case, you'll get a message like:

gcc -g -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/sqlite -I/usr/local/include/python2.1 -c _sqlite.c -o build/temp.linux-i686-2.1/_sqlite.o
_sqlite.c:30: sqlite.h: No such file or directory
error: command 'gcc' failed with exit status 1

In this case, you need to locate the header files and the libraries, and modify setup.py accordingly. For example, on linux and with sqlite built from source in /home/user/sqlite_build, you'll make the following changes:

if sys.platform in ("linux-i386", "linux2"): # most Linux
    include_dirs = ['/usr/include/sqlite', '/home/user/sqlite_build' ]
    library_dirs = ['/usr/lib/', '/home/user/sqlite_build/.libs' ]

Note 2:

Verify your pysqlite installation:

>>> import pysqlite

If you get a traceback saying:

ImportError: libsqlite.so.0: cannot open shared object file: No such file or directory

you forgot to put the sqlite libraries (located in sqlite_build/.libs if you built sqlite in directory sqlite_build/) where your system can find it. Either move them where they should be, or (unix) add this .libs directory in the environment variable LD_LIBRARY_PATH.