As explained here : https://gis.stackexchange.com/a/277071/20802 the standard Python framework on Mac OS X is not compile with the load extension function. Therefore it is impossible to use sql queries with this package and within QGIS (2.18 or 3.0) on Mac OSx.

The kyngchaos version of QGIS is compile to work with the standard version of Python (http://www.kyngchaos.com/software/qgis) but as this problem arise could someone tell me how to point out the pip version of Python to QGIS rather than the standard one? Or any other solution

https://gis.stackexchange.com/users/55203/steven-kay gave a link to an older topic which might was working with older python version. but wasn't successful with Python 3.6

2 Answers 2


It's not just a Mac OS X problem (Red Hat Bug 1066708 - Python sqlite3 module does not allow the loading of extensions (should be enabled), Anaconda sqlite not compiled with load extension capability, special python library needed for spatialite?, Problem loading spatialite extension with sqlite3 Python connector or Using pysqlite2 instead of sqlite3 when needed and many others)

For the Python version 2.7.x pre-installed by Apple (used by the Kyng Chaos QGIS 2.x versions), you can use the pysqlite module. The KyngChaos version of pyspatialite uses pysqlite and not sqlite3

import pyspatialite
import pysqlite2

For the QGIS 3.x version, Kyng Chaos specifies that you must install the python.org Python 3.6

  • It works before QGIS 2.18 I think I remember. But not since that. I know that 3.x version of QGIS Kyng Chaos specified this, this is exactly the problem
    – Arthur
    Apr 23, 2018 at 17:03
  • I have also an Unbutu running on my machine, and QGIS on this works perfectly fine with sql and python.
    – Arthur
    Apr 24, 2018 at 8:04

I recommend trying the latest version of QGIS for OS X, 3.0.3; the installer is now available directly from qgis.org and depends not on the OS X python but the official python.org distribution of 3.6. This should install more smoothly now for you.

  • That doesn't change anything to the problem, which is the official python disctribution coming without load extension enabled.
    – Arthur
    Jun 13, 2018 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.