I am attempting to use spatialite
with both Python 2 and 3 on Windows 7.
Rather than try to patch pyspatialite
for Python 3, I decided to use the load_extension
approach with sqlite3
Python built-in package, similar to how is done here: Sqlite load_extension fail for spatialite in Python and here: Use spatialite extension for SQLite on Windows.
But, on the official (C)Python 2.7 installer, the load_extension
was disabled for an issue related to MacOS. This is not with the counterpart for Python 3.4. Furthermore, both installers are built without SQLITE_ENABLE_RTREE=1
(that I'd also like to have).
At first, for Python 2.7, a workaround was to build pysqlite
tweaking the setup files to have both R*Tree and extensions. This way does not work for Python 3, since it does not seem to be supported by the current setup.py
. From my understand, this is because the package moved to the core Python repository: https://github.com/ghaering/pysqlite/issues/72#issuecomment-94319589
My current solution was to re-build both Python 2.7 and 3.4 with required settings for sqlite3
package. It worked, and I was able to load spatialite
as an extension and to create R*Tree.
Does it exist an alternative simpler solution? Did somebody find an alternative solution by working on the setup.py
of pyspatialite
or pysqlite
?