Cygwin Python and sqlite3

Apparently, cygwin’s distribution of Python 2.5.1 doesn’t come with sqlite3. This is a pity for those who would like to work with Django using cygwin Python.

Building _sqlite3.dll on cygwin is not too difficult. If you are in a hurry, heres the download _sqlite3.dll.

Prerequisites

  • /bin/cygsqlite3-0.dll
  • /bin/libpython2.5.dll
  • /usr/include/sqlite3.h
  • /usr/include/python2.5/Python.h [et.c]
tar jxf Python-2.5.2.tar.bz2 Python-2.5.2/Modules/_sqlite/
cd Python-2.5.2/Modules/_sqlite/
gcc -shared -o _sqlite3.dll -I /usr/include/python2.5 -L /bin -lpython2.5 -lsqlite3-0 -D'MODULE_NAME="_sqlite3"' *.c
cp _sqlite3.dll /usr/lib/python2.5/lib-dynload/

download

_sqlite3.dll

Update 10 Sept 2008

Download link fixed. (Thanks Steve)

Bookmark and Share

You should follow me on twitter here

9 Responses to “Cygwin Python and sqlite3”

  1. Steve Holden writes:

    I think your download link is incomplete. I’m getting a very polite 404 from it, anyway.

  2. Steve Holden writes:

    Brilliant! Thanks.

  3. Jeremy Muhlich writes:

    If you download the precompiled dll, be sure to run “chmod 770 _sqlite3.dll”. If the permissions are wrong, Django will fall back to the old pysqlite2 and complain about not finding *that*, obscuring the actual error from sqlite3. Thanks, Chui.

  4. Jeremy Muhlich writes:

    Sorry, that last sentence appears to be sarcastic but I really mean it — thank you! :)

  5. Chui writes:

    You are welcome

  6. Addy writes:

    I have been looking for solution for exactly this problem for a month until I found this!
    Thanks!!

  7. Keith writes:

    Quick note that if you didn’t install SQLite3 when setting up Cygwin, you need to install it. Rerun setup.exe and locate the SQLite3 Library package under databases. This will give you the first prerequisite (/bin/cygsqlite3-0.dll). Didn’t take me too long to figure that out, but hopefully this will save someone a few minutes down the road.

    Thanks for the post – it provided exactly the information I needed!

  8. Jon Cage writes:

    Actually, I don’t think this is required anymore if you just install the sqlite3 package Django works fine.

  9. Chui writes:

    Thanks Jon. I’ll update my copy.

Leave a Reply