SQLite for dbCCP4i: installation notes

These are notes on how to install SQLite and the Python interface to use the SQLite backend for dbCCP4i.

Packages to be installed

Obtain the SQLite package from the SQLite download page:

Obtain the Python DB-API interface for SQLite from pysqlite download page:

There is also a pysqlite installation guide at:

Installation procedure for Linux (ad hoc)

Pysqlite requires the installation of the SQLite libraries (version 3.3.2 or better). I downloaded the source code of the source tree for SQLite version 3.3.4 from http://www.sqlite.org/download.html. The installation instructions in the README file suggested that I should do the following:

  1. Unpack the targz file (into the sqlite-3.3.4 directory)
  2. Make a new directory parallel to this to perform the build in (e.g. mkdir build-sqlite-3.3.4)
  3. Change to this directory and execute the sqlite configure (e.g. ../sqlite-3.3.4/configure)
  4. Note that the default install location is /usr/local/ - you can over-ride this using the --prefix=... configure flag (I used this to install in a local area). You can also use the --with-tcl=... configure flag to set the location of the Tcl installation (I didn't do this).
  5. Run make/make install to build and install.

For the Python bindings, Python 2.3 or better is required (in addition to having SQLite installed).

I downloaded pysqlite 2.1.3. As SQLite is installed in a non-standard location I had to edit the setup.cfg file to point to where the header files and libraries have been installed. Then I ran "python setup.py build" from the pysqlite-2.1.3 directory, but go the following error:

[pjx@ccp4t pysqlite-2.1.3]$ python setup.py build

---------------------------------------------------------------------------
This script requires setuptools version 0.6a9 to run (even to display
help).  I will attempt to download it for you (from
http://cheeseshop.python.org/packages/2.3/s/setuptools/), but
you may need to enable firewall access for this script first.
I will start the download in 15 seconds.
---------------------------------------------------------------------------
Downloading http://cheeseshop.python.org/packages/2.3/s/setuptools/setuptools-0.6a9-py2.3.egg
Traceback (most recent call last):
  File "setup.py", line 27, in ?
    use_setuptools()
  File "/home/pjx/PACKAGES/pysqlite-2.1.3/ez_setup.py", line 84, in use_setuptools
    import setuptools; setuptools.bootstrap_install_from = egg
OverflowError: signed integer is greater than maximum

Try 2.0.7 instead ... however this gave the same errors. The following link http://peak.telecommunity.com/DevCenter/setuptools gives a clue - it suggests that the minimum Python version for setuptools on 64-bit platforms is 2.4.

I downloaded Python 2.4.3 from http://www.python.org/download/ and installed in a local area, then tried the 2.1.3 version of pysqlite - this time it appeared to compile without problems. I ran "python setup.py install" to install in the same area as the SQLite installation.

I then ran the tests as recommended in the installation document. Because I have installed everything in non-standard places, I needed to add the bin and lib directories to my PATH and LD_LIBRARY_PATH enviroment variables respectively.