Bug report #21899

Spatialite isn't working correctly on macOS

Added by MRick - over 4 years ago. Updated over 4 years ago.

Category:Data Provider/SpatiaLite
Affected QGIS version:3.6.1 Regression?:No
Operating System:macOS Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29714


In QGIS 3, I have to use the Cadastre plugin.

When installing, it begins with a Python error. I could repaire it by removing all the accented letters in the metadata.txt file.

But when it comes to create a new Spatialite database, it fails.
I had exactly the same problem with the version 2.18 which with a buggy spatiality version. I could get it working by installing an older SQLite version SQLite3_Framework- from http://www.kyngchaos.com/files/software/frameworks/SQLite3_Framework-
But it doesn't work with version 3…
This plugin works out-of-the-box in both Windows and Linux versions and on QGIS 2.16 for Mac or with version 2.18 when installing SQLite3_Framework-

It seems there is something broken in SQLite on the Mac version in all the recent versions from 2.18 and above.

Capture d’écran 2019-04-27 à 14.39.11.png - SQLite 3 framework content (361 KB) MRick -, 2019-04-27 02:56 PM

Capture d’écran 2019-04-27 à 14.51.47.png - Python console (48.2 KB) MRick -, 2019-04-27 02:56 PM

Capture d’écran 2019-05-04 à 13.44.36.png (531 KB) MRick -, 2019-05-04 01:49 PM


#1 Updated by Giovanni Manghi over 4 years ago

  • Status changed from Open to Feedback

isn't this a plugin problem?

#2 Updated by MRick - over 4 years ago

Giovanni Manghi wrote:

isn't this a plugin problem?

No since as I explained, I got it working under 2.18 version by installing an older SQLite version.
Plus if I load manually a previously created database from the database manager, the plugin won't be able to load it as well.
When opening the framework content, you can see the Python part PySQLite of Spatialite are missing in version 3.6.
It was the same problem in SQLite framework builds released after the 3.8.7.-1 version I listed above.
Plugins which are based on this python extension aren't working at all under Mac OS X.
But since under Python 3, PySQLite isn't supported, the SQLite3 version under Mac OS is probably missing some components dedicated to the Python 3 SQLite module and Spatialite which replace PySQLite.

When I run this command in the Python console, I get an error.

import sqlite3
with sqlite3.connect(":memory:") as conn:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 3, in <module>
pysqlite2.dbapi2.OperationalError: dlopen(mod_spatialite.dylib, 10): image not found

#4 Updated by MRick - over 4 years ago

I made a test:
I trashed all my complete Python installation Framework folder.
I trashed my QGIS application.

I reinstalled Python 3 and QGIS 3.6.2.

I still got the same issue.

#5 Updated by Giovanni Manghi over 4 years ago

  • Subject changed from Spatialite isn't working correctly to Spatialite isn't working correctly on macOS
  • Status changed from Feedback to Open
  • Operating System changed from MacOS to macOS

#6 Updated by MRick - over 4 years ago

This plugin does work well using PostgreSQL.
If I use this QGIS version, it does work perfectly as well.

It is definitely validating a trouble with the built of SQLite.

Also available in: Atom PDF