[Distutils] pysqlite egg problem

Phillip J. Eby pje at telecommunity.com
Sat Nov 5 17:28:54 CET 2005

At 12:02 PM 11/5/2005 +0000, Robin Becker wrote:
>I'm trying to follow the Turbogears wiki20, but I came across a problem
>with pysqlite.
>First off I am a complete newbie to the easy_setup and egg stuff and
>also have zero knowledge of pysqlite, but assuming that the filename I
>chose didn't have to exist I found that TG's tg-admin sql create failed.
>I assumed I needed to get some sort of database set up first so tried
>this to learn about pyslite
>Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310 32 bit (Intel)] on
>Type "help", "copyright", "credits" or "license" for more information.
>  >>> from pysqlite2 import dbapi2 as sqlite
>Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
>    File
>line 32, in ?
>    File
>line 7, in ?
>    File
>line 6, in __bootstrap__
>ImportError: DLL load failed: The specified module could not be found.
>  >>>
>I checked in the egg and the dll is certainly there as

That's the problem: it should just be pysqlite2/sqlite3.dll; the 
lib/site-packages is extraneous.  It appears that the way that pysqlite 
chooses to install the DLL is as a data file with an absolute 
path.  Unfortunately, setuptools has limited ability to virtualize such 
paths, and the way pysqlite's setup script is setting that path is 
non-standard, as it's using backslash path separators rather than 
slashes.  I'll have to look into whether there's some kind of workaround I 
can do.

The other issue is that either the DLL needs to be listed in the egg's 
"eager resources", or else the whole egg needs to be marked as not zip-safe 
(i.e. it must be installed uncompressed).  I suppose I should also look at 
automatically detecting .dll and .so files that are listed as data files, 
as that's what's happening here.  (That is, the sqlite3.dll file is listed 
as a data file.)

As a workaround for now, run this:

     easy_install -UZ pysqlite

which will "upgrade" (reinstall) the egg in unzipped form.  Then, move the 
sqlite3.dll file to the pysqlite2 subdirectory under the .egg 
directory.  That should get you working for now.

More information about the Distutils-SIG mailing list