Bug 1309860

Summary: QGIS Python Console Broken
Product: [Fedora] Fedora EPEL Reporter: Aaron Sowry <aaron>
Component: qgisAssignee: Jonathan Wright <jonathan>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: epel7CC: aaron, davejohansen, rdieter, svenmueller88, volker27
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-07-08 22:22:14 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 Aaron Sowry 2016-02-18 20:24:47 UTC
Description of problem:

Launching QGIS after installation immediately results in the following traceback in the GUI (although the application still launches):

--
{Couldn't load plugin 'processing' from ['/usr/share/qgis/python', '/home/qgisosr/.qgis2/python', '/home/qgisosr/.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-2.8-gtk2-unicode', '/usr/lib/python2.7/site-packages', '/home/qgisosr/.qgis2//python', '/usr/share/qgis/python/plugins/fTools/tools']


Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 196, in loadPlugin
    __import__(packageName)
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, 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 478, 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 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/core/Processing.py", line 44, in
    from processing.gui.Postprocessing import handleAlgorithmResults
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/gui/Postprocessing.py", line 36, in
    from processing.gui.ResultsDialog import ResultsDialog
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/gui/ResultsDialog.py", line 33, in
    from processing.ui.ui_DlgResults import Ui_DlgResults
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/plugins/processing/ui/ui_DlgResults.py", line 61, in
    from QtWebKit.QWebView import QWebView
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named QtWebKit.QWebView
--

Trying to launch the Python Console in the application results in the following GUI traceback:

--
Traceback (most recent call last):
  File "", line 1, in
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/console/__init__.py", line 26, in
    from console import show_console
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/console/console.py", line 29, in
    from console_settings import optionsDialog
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/console/console_settings.py", line 24, in
    from console_compile_apis import PrepareAPIDialog
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/console/console_compile_apis.py", line 28, in
    from ui_console_compile_apis import Ui_APIsDialogPythonConsole
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/share/qgis/python/console/ui_console_compile_apis.py", line 70, in
    from Qsci.qsciscintilla import QsciScintilla
  File "/usr/lib64/python2.7/site-packages/qgis/utils.py", line 478, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named Qsci.qsciscintilla
--

The fixes for these errors are simple, so I won't bother making a patch, but it's basically a matter of substituting "from QtWebKit.QWebView import QWebView" with "from PyQt4.QtWebKit import QWebView" in the following files:

/usr/share/qgis/python/plugins/processing/ui/ui_DlgResults.py
/usr/share/qgis/python/plugins/processing/ui/ui_DlgGetScriptsAndModels.py
/usr/share/qgis/python/plugins/processing/ui/ui_DlgHelpEdition.py
/usr/share/qgis/python/plugins/processing/ui/ui_DlgAlgorithmBase.py

The second error (when launching) is resolved by replacing "from Qsci.qsciscintilla import QsciScintilla" with "from PyQt4.Qsci import QsciScintilla" in the following file:

/usr/share/qgis/python/console/ui_console_compile_apis.py

Note that the bytecode will need to be recompiled for these fixes to work on a live system.


Version-Release number of selected component (if applicable):
qgis-2.8.4-1.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Install QGIS
2. Launch QGIS
3. Launch Python Console in QGIS

Actual results:
Tracebacks as per description, Python console doesn't work.

Expected results:
No tracebacks, working Python console.

Additional info:

Comment 1 Aaron Sowry 2016-02-18 20:27:00 UTC
I should probably add this was on CentOS Linux release 7.2.1511 (Core)

Comment 2 Rex Dieter 2016-09-14 13:31:57 UTC
adding "Patch" keyword, per the suggested fix(es), despite there strictly being no formal patch

Comment 3 Aaron Sowry 2016-09-26 23:44:52 UTC
Just a heads-up - it seems that the fix above isn't applicable to most recent QGIS package (2.14.3-3.el7.x86_64), since the files mentioned don't exist any more. In case it's of any interest, one workaround without having to modify any source code is as follows:

# mkdir /usr/share/qgis/python/QtWebKit
# touch /usr/share/qgis/python/QtWebKit/__init__.py
# echo "from PyQt4.QtWebKit import QWebView" > /usr/share/qgis/python/QtWebKit/QWebView.py

Comment 4 svenmueller88 2016-10-19 11:29:10 UTC
Yes it's still of interest.
Sadly this fix caused my QGIS to be completly broken.
Upon loading it crashes (segmentation fault (core dumped))
I am working on QGIS 2.14.3-3.el7 from the EPEL repository on Scientific Linux release 7.2 (Nitrogen).
The processing error has been as noted above. Though QGIS just crashed upon trying to open the Python console.

Comment 5 Dave Johansen 2016-10-19 14:40:53 UTC
PyQwt doesn't work with Qwt 6 and it would likely take a fair amount to resolve that ( http://lists.osgeo.org/pipermail/qgis-developer/2015-June/038105.html ).

Comment 6 svenmueller88 2016-10-21 11:59:46 UTC
Do I understand it correctly that QGIS 2.14 won't be working on Scientific Linux anytime soon then?
Will there be a 2.16 release?

Comment 7 Dave Johansen 2016-10-21 15:05:26 UTC
The plan is to just update to LTRs in EPEL, but there's a COPR for 2.16:
https://copr.fedorainfracloud.org/coprs/g/scitech/qgis/

Comment 8 Fedora Admin user for bugzilla script actions 2022-09-09 13:35:16 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 9 Troy Dawson 2024-07-08 22:22:14 UTC
EPEL 7 entered end-of-life (EOL) status on 2024-06-30.\n\nEPEL 7 is no longer maintained, which means that it\nwill not receive any further security or bug fix updates.\n As a result we are closing this bug.