Pysqlite

pysqlite is SQLite Bindings for Python for SQLite versions 2.8.x and 3.x (official wiki)

=DreamHost Version= At 2007-03-09 DreamHost has sqlite 2.8.16 and sqlite3 3.2.1 installed.

$ sqlite3 -version 3.2.1 $ sqlite -version 2.8.16

pysqlite has three major versions (from pysqlite wiki): >>> import sqlite >>> sqlite.version '1.0.1' not installed >>> from pysqlite2 import dbapi2 >>> dbapi2.version '2.0.5'
 * 1.0.1 - the latest for SQLite 2.x databases and installed on DreamHost
 * 1.1.x - compatibility version to allow old applications who uses SQLite 2.x database to run with SQLite 3.x
 * 2.x.x - optimized version for use with SQLite 3.x databases, 2.0.5 is currently installed on DreamHost

=Downloading=

Version 1.1.8
wget http://initd.org/pub/software/pysqlite/releases/1.1/1.1.8/pysqlite-1.1.8.tar.gz tar zxf pysqlite-1.1.8.tar.gz cd pysqlite

Version 2.3.3
wget http://initd.org/pub/software/pysqlite/releases/2.3/2.3.3/pysqlite-2.3.3.tar.gz tar zxf pysqlite-2.3.3.tar.gz cd pysqlite-2.3.3

=Configuring=

Modify setup.py and change the include_dirs and library_dirs to where you installed the packages.

include_dirs = ['/home/USER/include'] library_dirs = ['/home/USER/lib']
 * 1) change them to these two lines, changing USER to be your unix login

=Installation=

~/bin/python setup.py build ~/bin/python setup.py install

= Alternative instructions based on Unix account setup and a newer version of Python =

Prerequisites

 * Configure your shell account as explained in Unix account setup, including the .bashrc file.
 * Install Python 2.5.1 and SWIG as explained in Installing Python 2.5.1 with the Unix account setup
 * Install SQLite (you can install version 2 and/or version 3, see SQLite).

Select pysqlite Version
Depending on the version(s) of SQLite you have installed and the API you want to use, you may want to install pysqlite version 2.x (sqlite3, current API), pysqlite 1.1.x (sqlite3, legacy API), and/or pysqlite 1.0.x (sqlite2, legacy API), see.

You can install more than one version.

Put the version you chose in an environment variable. Current (August 2007) versions are: VERSION=2.3.5

VERSION=1.1.8a or VERSION=1.0.1

Now, generate variables to be able to use parts of the version number when downloading files:

VERSMINOR=${VERSION:0:5} VERSMAJOR=${VERSION:0:3} VERSINTEGER=${VERSION:0:1}

Download and Open pysqlite
mkdir -pv ${HOME}/soft cd ${HOME}/soft wget http://initd.org/pub/software/pysqlite/releases/${VERSMAJOR}/${VERSMINOR}/pysqlite-${VERSION}.tar.gz tar xvzf pysqlite-${VERSION}.tar.gz if [ ${VERSINTEGER} -lt 2 ] then mv -v pysqlite pysqlite-${VERSION} fi cd pysqlite-${VERSION}
 * 1) 1.x versions open in an unversioned directory name, let's rename it

Configure
Tell the installer where to install pysqlite: LOCALBASE=${RUN}
 * 1) For versions 1.x the environment variable ${LOCALBASE}
 * 2) holds the directory that will be used as a base
 * 3) for installing

cd ${HOME}/soft/pysqlite-${VERSION}

if [ ${VERSINTEGER} -ge 2 ] then mv -v setup.cfg setup-ORIG.cfg sed -r -e "s#^([ \t]*)include_dirs[ \t]*=.*#\1include_dirs=${RUN}/include#" \ -e "s#^([ \t]*)library_dirs[ \t]*=.*#\1include_dirs=${RUN}/lib#" setup-ORIG.cfg \ > setup.cfg fi
 * 1) For version 2.x you have to edit the new

Build and Install
python setup.py build python setup.py install