Bug 1309860 - QGIS Python Console Broken
QGIS Python Console Broken
Status: NEW
Product: Fedora EPEL
Classification: Fedora
Component: qgis (Show other bugs)
epel7
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Dave Johansen
Fedora Extras Quality Assurance
: Patch
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-18 15:24 EST by Aaron Sowry
Modified: 2016-10-21 11:05 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Aaron Sowry 2016-02-18 15:24:47 EST
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 15:27:00 EST
I should probably add this was on CentOS Linux release 7.2.1511 (Core)
Comment 2 Rex Dieter 2016-09-14 09:31:57 EDT
adding "Patch" keyword, per the suggested fix(es), despite there strictly being no formal patch
Comment 3 Aaron Sowry 2016-09-26 19:44:52 EDT
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 07:29:10 EDT
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 10:40:53 EDT
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 07:59:46 EDT
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 11:05:26 EDT
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/

Note You need to log in before you can comment on or make changes to this bug.