[Qgis-developer] Spatialite KyngChaos packaging on OSX not loading spatialite extension

David Marteau dmarteau at 3liz.com
Mon Apr 3 06:29:32 PDT 2017


Hi,


For some times some people are reporting that plugins using pyspatialite are not working anymore  with the KyngChaos packaging for OSX (2.14 or 2.18)

The error is usually:

OperationalError('no such module: VirtualSpatialIndex',)

when trying to référence SpatialIndex in spatial requests.
After investigation it appears that errors occurs when trying to use spatialite functions…

The fact is, when using pyspatialite directly from python: the spatialite extension is not loaded.

cur.execute('SELECT spatialite_version()')
> OperationalError: no such function: spatialite_version

and so on for any SELECT involving spatialite functions.

This can be explained easily has the pyspatialite python package is only a link to the pysqlite2 python package, and thus, do not load the the spatialite module. 

Furthemore loading extension is disabled in the KyngChaos sqlite3 package, so we are stuck in that the pyspatialite provided by KyngChaos is useless as standalone library and do not enable plugins to make direct calls to  spatialite.


Is there any reason for this situation or this should be considered as a bug ?? 

Actually, the native OSX sqlite3 python binding do not enable leading extensions, this was preventing using spatialite from python. This constraint has been removed recently in Macport, which now enables to use spatialite with python without relying on pyspatialite.



David.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170403/e574498d/attachment.html>


More information about the Qgis-developer mailing list