I am trying to use the Spatialite beta version 3.0 because I am using Windows 7 on a 64-bit machine.
I consistently get the dreaded sqlite3.OperationalError: The
specified module could not be found.
error when I try to load
libspatialite-4.dll
.
I have tried the following:
libspatialite-4.dll
and all the other dlls in the same folder'PATH'
environment variablec:\windows\system32
folder (complete with restart of the machine)c:\windows\sysWoW64
folder (complete with restart of the machine this is supposed to be for 32 bit dlls but I tried it anyway)my code is as follows:
import sqlite3
conn = sqlite3.connect(":memory:")
conn.enable_load_extension(True)
conn.execute('SELECT load_extension("libspatialite-4.dll")')
NOTE - I have tried the full path too with no luck. I remember having the same problem with Windows XP 32-bit. I got it working but can't remember what I did :(
UPDATE
I have tested the setup on 32-bit Windows 7 and putting all the dlls in the System32 folder works. So, this suggests that there is some problem with the 64-bit setup. Could it be that I need another version of MSVC (I don't think the Spatialite website says which is necessary so I might just have to guess - I have MSVC2010 installed)?
The version of sqlite3.dll
included with Python doesn't seem to want to play nice with Spatialite. The only thing I could get to work (short of compiling everything from source) was:
sqlite-dll-win32-x86-[version].zip
mod_spatialite-[version]-win-x86.7z
sqlite3.dll
that is in your Python DLLs directory, to something like sqlite3_old.dll
, so that Python will use the new one on your pathSee this blog post for more info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With