Bug report #18430

Multiple extension and plugin bug QGIS3 osx

Added by Arthur Vignacq over 6 years ago. Updated over 5 years ago.

Status:Feedback
Priority:Normal
Assignee:-
Category:mac_os_specific
Affected QGIS version:3.4.4 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 #:26319

Description

Hi,
I've installed QGIS3 from King Chaos today and found 5 different bug with:
  • Mask extension
  • nominatim extension
  • QBano extension
  • cartogram3 extension
  • db_manager

The one most annoying is db_manager as I can't use spatialite with this error.

Une erreur est survenue lors de l'éxécution du code Python: 

AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension' 
Traceback (most recent call last):
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_model.py", line 441, in rowCount
    self._refreshIndex(parent, True)
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_model.py", line 490, in _refreshIndex
    if item.populate():
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_model.py", line 167, in populate
    if not connection.connect():
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/plugin.py", line 80, in connect
    return self.connectToUri(uri)
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/plugin.py", line 109, in connectToUri
    self.db = self.databasesFactory(self, uri)
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/plugin.py", line 66, in databasesFactory
    return SLDatabase(connection, uri)
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/plugin.py", line 109, in __init__
    Database.__init__(self, connection, uri)
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/plugin.py", line 218, in __init__
    self.connector = self.connectorsFactory(uri)
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/plugin.py", line 112, in connectorsFactory
    return SpatiaLiteDBConnector(uri)
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/connector.py", line 51, in __init__
    self.connection = spatialite_connect(self._connectionInfo())
  File "/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 596, in spatialite_connect
    con.enable_load_extension(True)
AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension'

Version de Python : 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] 
Version de QGIS : 3.0.0-Girona Girona, exported 

Chemin Python :
/Applications/QGIS 3.app/Contents/MacOS/../Resources/python
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS 3.app/Contents/MacOS/../Resources/python/plugins
/Library/Frameworks/GEOS.framework/Versions/3B/Python/3.6/site-packages
/Library/Frameworks/GDAL.framework/Versions/2.2/Python/3.6/site-packages
/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/mmqgis/forms

extensionLineMac.png - line 1244 from setup.py of Python distribution (158 KB) Linwood Creekmore, 2018-12-27 01:15 PM

pythonSoftwareSqlite.png - Instructions from python.org to enable extensions. (162 KB) Linwood Creekmore, 2018-12-27 01:18 PM

History

#1 Updated by Jürgen Fischer over 6 years ago

  • Category changed from Python plugins to Build/Install

#2 Updated by Jürgen Fischer over 6 years ago

  • Description updated (diff)

#3 Updated by Steven Kay over 6 years ago

Arthur Vignacq wrote:

Hi,
I've installed QGIS3 from King Chaos today and found 5 different bug with:
  • Mask extension
  • nominatim extension
  • QBano extension
  • cartogram3 extension
  • db_manager

The one most annoying is db_manager as I can't use spatialite with this error.

[...]

I had a look into the SQLite support issue - this affects the KyngChaos build as of 3.0.0-3 (I've not tried this using brew). See https://gis.stackexchange.com/a/277071/55203 .

The browser panel can still be used to add Spatialite/SQLite/GPKG, perhaps as this is using C++/GDAL rather than Python?

It seems that on the Mac, the standard python spatialite3 build is not compiled with loadable extension support as standard. See https://riccardo.forina.me/spatialite-for-python-does-not-work-on-osx/

I could reproduce this outside of QGIS in standalone python using the standard Mac python 3.6, but the equivalent Brew-installed version works fine.

#4 Updated by Ronan L over 6 years ago

3.0.2 version from qgis.org has the same behaviour.
the problem comes with python 3 from python.org , enable_load_extensions is not compiled in . And because QGIS IS linked to this there is no way to use spatialite with python.

Also there is no way to user brewed python3 with QGIS 3

#5 Updated by Arthur Vignacq over 6 years ago

Tested again with version 3.0.3 same problem.

Does anyone hava a solution to enable load extesion within pythn 3.6 and get rid of this.

I don't know how many people can't use database function because of this.

#6 Updated by Harrissou Santanna over 6 years ago

  • Status changed from Open to Feedback

#7 Updated by Arthur Vignacq over 6 years ago

Thank you, I already tried it, but nothing new with this :

AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension' 
Traceback (most recent call last):
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_model.py", line 441, in rowCount
    self._refreshIndex(parent, True)
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_model.py", line 490, in _refreshIndex
    if item.populate():
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_model.py", line 167, in populate
    if not connection.connect():
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/plugin.py", line 80, in connect
    return self.connectToUri(uri)
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/plugin.py", line 109, in connectToUri
    self.db = self.databasesFactory(self, uri)
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/plugin.py", line 66, in databasesFactory
    return SLDatabase(connection, uri)
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/plugin.py", line 109, in __init__
    Database.__init__(self, connection, uri)
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/plugin.py", line 218, in __init__
    self.connector = self.connectorsFactory(uri)
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/plugin.py", line 112, in connectorsFactory
    return SpatiaLiteDBConnector(uri)
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/spatialite/connector.py", line 51, in __init__
    self.connection = spatialite_connect(self._connectionInfo())
  File "/Applications/QGIS3.app/Contents/MacOS/../Resources/python/qgis/utils.py", line 596, in spatialite_connect
    con.enable_load_extension(True)
AttributeError: 'sqlite3.Connection' object has no attribute 'enable_load_extension'

Python version: 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 03:03:55) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] 
QGIS version: 3.0.3-Girona Girona, exported 

Python Path:
/Applications/QGIS3.app/Contents/MacOS/../Resources/python
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS3.app/Contents/MacOS/../Resources/python/plugins
/Library/Frameworks/Python.framework/Versions/3.6/lib/python36.zip
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/lib-dynload
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/DigitizingTools/tools
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/mmqgis/forms
/Users/arthur/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/NNJoin

#8 Updated by Giovanni Manghi about 6 years ago

Any difference with 3.2/master?

#9 Updated by Linwood Creekmore almost 6 years ago

I can confirm that the latest QGIS on Mac as of 22 December still has the DB Manager problem with Spatialite. I can't open or filter any spatialite files in QGIS and get the "extension" error referenced above. line 595 in the utils.py code.

I can't get Python to build on my Mac OS (running Sierra) so this seems like a lingering issue for lots of folks.

#10 Updated by Linwood Creekmore almost 6 years ago

Linwood Creekmore wrote:

I can confirm that the latest QGIS on Mac as of 22 December still has the DB Manager problem with Spatialite. I can't open or filter any spatialite files in QGIS and get the "extension" error referenced above. line 595 in the utils.py code.

I can't get Python to build on my Mac OS (running Sierra) so this seems like a lingering issue for lots of folks.

I searched around and found the exact line in the Python Source distribution that causes the problem. According to the python.org page on sqlite3 (https://docs.python.org/2/library/sqlite3.html#multithreading), you need to delete a line from the setup.py file for your Python distribution. We need to delete line 1244 and rebuild python I assume. Others can try as well and report back. If I'm successful, will let you know.

I added to pictures to show the line and the instructions from python.org.

#11 Updated by bradypus - almost 6 years ago

Hello,
it is still not working on: 3.4.4-Madeira
Some more info:

QGIS code branch: Release 3.4
Compiled against Qt: 5.11.2
Running against Qt: 5.11.2
Compiled against GDAL/OGR:2.3.3
Running against GDAL/OGR: 2.3.3
Compiled against GEOS: 3.7.1-CAPI-1.11.0
Running against GEOS: 3.7.1-CAPI-1.11.1 27a5e771
PostgreSQL Client Version: 9.6.10
SpatiaLite Version: 4.4.0-RC1
QWT Version: 6.1.3
QScintilla2 Version: 2.10.8
PROJ.4 Version: 493

#12 Updated by Giovanni Manghi over 5 years ago

  • Operating System changed from Osx to macOS
  • Category changed from Build/Install to mac_os_specific
  • Affected QGIS version changed from 3.0.0 to 3.4.4

Please try with a new/clean profile.

Also available in: Atom PDF