Bug report #21899

Spatialite isn't working correctly on macOS

Added by MRick - about 5 years ago. Updated almost 5 years ago.

Status:Open
Priority:Normal
Assignee:-
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

Description

In QGIS 3, I have to use the Cadastre plugin.
https://github.com/3liz/QgisCadastrePlugin

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-3.8.7.3-1.dmg from http://www.kyngchaos.com/files/software/frameworks/SQLite3_Framework-3.8.7.3-1.dmg
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-3.8.7.3-1.dmg

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

History

#1 Updated by Giovanni Manghi about 5 years ago

  • Status changed from Open to Feedback

isn't this a plugin problem?

#2 Updated by MRick - almost 5 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:
conn.enable_load_extension(True)
conn.load_extension("mod_spatialite")

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 - almost 5 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 almost 5 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 - almost 5 years ago

This plugin does work well using PostgreSQL.
If I use this QGIS version, it does work perfectly as well.
https://lutraconsulting.github.io/qgis-mac-packager/

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

Also available in: Atom PDF