Bug 1340535

Summary: Couldn't load plugin 'processing' with qgis-python installed
Product: [Fedora] Fedora Reporter: Julien Enselme <jujens>
Component: qgisAssignee: Volker Fröhlich <volker27>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: bruno, cristian.balint, davejohansen, dbranchini, eliadevito, emanuele, evan.rosenlieb, lars, pablohn6, thomas.v.ziminski, volker27
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-08 14:40:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Julien Enselme 2016-05-27 18:51:29 UTC
Description of problem:


Version-Release number of selected component (if applicable): 2.14.3


How reproducible:


Steps to Reproduce:
1. Install qgis and qgis-python
2. Launch qgis
3. The problem should appear
4. Click OK and qgis should start normally

Actual results:
I have an error dialog box containing this error message:

Couldn't load plugin 'processing' 

ImportError: No module named pyspatialite 
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 281, in loadPlugin
    __import__(packageName)
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/__init__.py", line 29, in 
    from processing.tools.general import *
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/tools/general.py", line 28, in 
    from processing.core.Processing import Processing
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/core/Processing.py", line 40, in 
    from processing.core.GeoAlgorithm import GeoAlgorithm
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/core/GeoAlgorithm.py", line 41, in 
    from processing.core.parameters import ParameterRaster, ParameterVector, ParameterMultipleInput, ParameterTable, Parameter
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/core/parameters.py", line 33, in 
    from processing.tools.vector import resolveFieldIndex, features
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/tools/vector.py", line 20, in 
    from processing.algs.qgis import spatialite_utils
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/algs/qgis/spatialite_utils.py", line 28, in 
    from pyspatialite import dbapi2 as sqlite
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named pyspatialite


Python version: 2.7.11 (default, Feb  5 2016, 01:53:41) [GCC 6.0.0 20160201 (Red Hat 6.0.0-0.9)] 
QGIS version: 2.14.3-Essen Essen, exported 

Python Path:
/usr/share/qgis/python
/home/jenselme/.qgis2/python
/home/jenselme/.qgis2/python/plugins
/usr/share/qgis/python/plugins
/usr/lib64/python27.zip
/usr/lib64/python2.7
/usr/lib64/python2.7/plat-linux2
/usr/lib64/python2.7/lib-tk
/usr/lib64/python2.7/lib-old
/usr/lib64/python2.7/lib-dynload
/usr/lib64/python2.7/site-packages
/usr/lib64/python2.7/site-packages/gst-0.10
/usr/lib64/python2.7/site-packages/gtk-2.0
/usr/lib64/python2.7/site-packages/wx-3.0-gtk3
/usr/lib/python2.7/site-packages
/usr/lib/python2.7/site-packages/FontTools
/home/jenselme/.qgis2//python
/usr/share/qgis/python/plugins/fTools/tools


Expected results:
No error message when qgis starts.

Comment 1 thomas.v.ziminski 2016-06-07 01:50:15 UTC
I also get this same exact bug.

Couldn't load plugin 'processing' 

ImportError: No module named pyspatialite 
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 281, in loadPlugin
    __import__(packageName)
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/__init__.py", line 29, in 
    from processing.tools.general import *
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/tools/general.py", line 28, in 
    from processing.core.Processing import Processing
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/core/Processing.py", line 40, in 
    from processing.core.GeoAlgorithm import GeoAlgorithm
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/core/GeoAlgorithm.py", line 41, in 
    from processing.core.parameters import ParameterRaster, ParameterVector, ParameterMultipleInput, ParameterTable, Parameter
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/core/parameters.py", line 33, in 
    from processing.tools.vector import resolveFieldIndex, features
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/tools/vector.py", line 20, in 
    from processing.algs.qgis import spatialite_utils
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/algs/qgis/spatialite_utils.py", line 28, in 
    from pyspatialite import dbapi2 as sqlite
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 572, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named pyspatialite


Python version: 2.7.11 (default, Feb  5 2016, 01:53:41) [GCC 6.0.0 20160201 (Red Hat 6.0.0-0.9)] 
QGIS version: 2.14.3-Essen Essen, exported 

Python Path:
/usr/share/qgis/python
/home/thomas.v.ziminski/.qgis2/python
/home/thomas.v.ziminski/.qgis2/python/plugins
/usr/share/qgis/python/plugins
/usr/lib64/python27.zip
/usr/lib64/python2.7
/usr/lib64/python2.7/plat-linux2
/usr/lib64/python2.7/lib-tk
/usr/lib64/python2.7/lib-old
/usr/lib64/python2.7/lib-dynload
/usr/lib64/python2.7/site-packages
/usr/lib64/python2.7/site-packages/gtk-2.0
/usr/lib64/python2.7/site-packages/wx-3.0-gtk3
/usr/lib/python2.7/site-packages
/home/thomas.v.ziminski/.qgis2//python

Comment 2 Lars Kellogg-Stedman 2016-06-13 16:02:50 UTC
You can work around this problem by running:

  dnf -y install redhat-rpm-config
  CFLAGS=-I/usr/include pip install pyspatialite

Comment 3 Lars Kellogg-Stedman 2016-06-13 16:11:42 UTC
Sorry, I neglected to include some dependencies in that last comment that were already installed in my system.  That should be:

  dnf -y install gcc redhat-rpm-config python-pip \
    python-devel sqlite-devel proj-devel geos-devel
  CFLAGS=-I/usr/include pip install pyspatialite

Comment 4 Evan 2016-07-26 22:06:35 UTC
Hello,

Just chipping in to say that I had the same problem and it was solved by Lars suggestion.

Comment 5 Emanuele Di Giacomo 2016-11-09 10:25:21 UTC
Reading the spec file of the qgis package (http://pkgs.fedoraproject.org/cgit/rpms/qgis.git/tree/qgis.spec?h=f24), I have found that the bundled version of pyspatialite was disabled (see lines 44-47).

Moreover, starting from F20 it's possibile to load sqlite extensions in Python (see lines 49-50 of the same spec file).

A very simple wrapper should solve the problem (it could be installed in qgis python path, e.g. /usr/share/qgis/python or $HOME/.qgis2/python):

    # file pyspatialite.py
    from sqlite3 import *

    def connect(*args, **kwargs):
        import sqlite3
        db = sqlite3.connect(*args, **kwargs)
        db.enable_load_extension(True)
        db.load_extension("mod_spatialite")
        return db

I have saved the wrapper in $HOME/.qgis2/python/pyspatialite.py and successfully imported a vector file in an existing spatialite database using the DB Manager plugin.

Comment 6 Volker Fröhlich 2017-03-10 20:25:16 UTC
*** Bug 1431194 has been marked as a duplicate of this bug. ***

Comment 7 Fedora End Of Life 2017-07-25 20:55:26 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 8 Fedora End Of Life 2017-08-08 14:40:31 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.