Odd error when installing apsw on Windows

Question:

I tried to install apsw on another system, we got a multitude of errors, depending on how we installed it. First off, installing via exe gave us a "This application is not a valid win32 program" When we manually installed it from my system, we got a "ImportError: DLL load failed: %1 is not a valid Win32 application." And we have some complications with building the module too with sqlite3.dll and sqlite3.lib.

Asked By: Varriount

||

Answers:

32-bit and 64-bit binaries are different animals, and can be mixed only if you know what you are doing.
Did you try installing python 2.6 32-bit on your friend’s machine?

Why are you using apsw instead of the standard library sqlite3?

Answered By: Terrel Shumway

Disclosure: I am the APSW author

The APSW web site includes an entire page listing reasons why you’d use APSW over pysqlite. Also note that the pysqlite included in the standard library is even older than current pysqlite code.

Currently I only provide compiled Windows APSW extensions for 32 bit Pythons. You can run 32 and 64 bit Python on 64 bit Windows if you install them to different directories. However the bitness of extensions must match the bitness of the Python you are using it with.

Your short term solution is to also install 32 bit Python on the 64 bit machine. Alternatively you can compile a 64 bit extension yourself. In theory this is as simple as installing Visual Studio 2008 Express from http://www.microsoft.com/express/Downloads/#2008-All (note use 2008 version not 2010 version), downloading the APSW source zip from http://code.google.com/p/apsw/downloads/list and then running python setup.py fetch --all build --enable-all-extensions install

Edit (2010-Nov-07) If you have Visual Studio 2008 Professional installed then that should just work. Express did not include the 64 bit compilers originally although they are now included but Python’s distutils and most of the rest of VS 2008 doesn’t know about them. Email me if you want to do the build yourself and I’ll give more detailed information. The next APSW release will include Windows 64 bit binaries for Python 2.6 and above including the Python 3 series.

Edit (2010-Dec-15) APSW 3.7.4-r1 now includes official 64 bit Windows binary downloads over at http://code.google.com/p/apsw/downloads/list

Answered By: Roger Binns
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.