I wanted to get a Django site working under Python 2.5 the other day using Sqlite. I downloaded the source for Python 2.5 (even though 2.5 is in the Ubuntu repository), compiled, downloaded the Django 0.95 release, installed it, and tried to create a new blank database. Error. Here is the exact traceback:

Traceback (most recent call last):
File "manage.py", line 2, in
from django.core.management import execute_manager
ImportError: No module named django.core.management

After digging for a few minutes, I realized that I didn’t have the Sqlite header files on my system when I compiled Python. I added the libsqlite-dev package on my laptop (which is running Ubuntu), did the make && make install dance, and tried it again. No error.

Had I taken the time to read all 1291 lines of the README in the Python 2.5 release, I would have read this around line 760:

Building the sqlite3 module
—————————

To build the sqlite3 module, you’ll need the sqlite3 or libsqlite3
packages installed, including the header files. Many modern operating
systems distribute the headers in a separate package to the library -
often it will be the same name as the main package, but with a -dev or
-devel suffix.

The version of pysqlite2 that’s including in Python needs sqlite3 3.0.8
or later. setup.py attempts to check that it can find a correct version.

Now all is well with the world.