sourcepole / qgis-openlayers-plugin

Openlayers plugin for QGIS
GNU General Public License v2.0
172 stars 108 forks source link

"Cannot import name QtWebKit" message when installing OpenLayers plugin #56

Open redhumus opened 6 years ago

redhumus commented 6 years ago

Hi, I'm using a fresh install of Ubuntu Bugie 18.04 on a laptop ASUS X550. I have QGIS 2.18.17 . When I try to install de OpenLayers plugin I receive this error "Cannot import name QtWebKit"

I red different posts, they conclude that the QGIS code doesn't uses anymore the python QtWebKit. Also I red that new versions of QGIS after 2.16 would fix this problem. CAn you help me?

rbracket commented 6 years ago

I had the same experience. The error log mentioned a required package. It was, if I recall correctly, python3-pyqt5.qtwebkit

I installed python3-pyqt5.qtwebkit, unistalled the OpenLayers plugin, re-installed.

Success..

Ubuntu, QGIS 3.0.2

hadmut commented 6 years ago

Having the same problem, I cannot reproduce that fix/workaround.

The plugin version qgis downloads requires and uses PyQt4, which is not contained in Ubuntu 18.04 anymore. There's just PyQt5. So I don't see how this could work to install python3-pyqt5.qtwebkit, especially since ubuntu's version of qgis uses /usr/bin/python, which is a symlink to python2.7.

So there's two reasons why python3-pyqt5.qtwebkit doesn't seem to help: The 3 and the 5.

regards

mone27 commented 6 years ago

@rbracket I have the same issue maybe you are using qgis3

rbracket commented 6 years ago

Yes, I’m using QGIS 3..I forget the version, but my intention is to always have last nights...

I can test again in a few days. No production work going on, just a hobby.

Katie

On Sat, May 26, 2018 at 1:01 AM mone27 notifications@github.com wrote:

@rbracket https://github.com/rbracket I have the same issue maybe you are using qgis3

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sourcepole/qgis-openlayers-plugin/issues/56#issuecomment-392245001, or mute the thread https://github.com/notifications/unsubscribe-auth/AAqCBgMskzhi3HLT5Mc8NAbX4_SBS8mTks5t2QvZgaJpZM4TzFto .

-- Katie Urey Portland, Oregon 503-228-3083 (land line with saxophone greeting) 503-780-9034 (cell, though not always "on") ksurey@gmail.com

mone27 commented 6 years ago

Maybe I found the origin of the problem. Since Qt 5.6 QtWebKitWidget has been replaced by QtWebEngineWidget so since Ubuntu 18.04 uses Qt 5.9 it will never work. We should patch openlayers, porting should not be too difficult http://doc.qt.io/qt-5/qtwebenginewidgets-qtwebkitportingguide.html. Now I don't have time to do a PR I hope will do it soon.

aloboa commented 6 years ago

I have the same problem at installing Openlayers on Debian testing (Buster): QGIS version | 2.18.20 | QGIS code branch | Release 2.18 Compiled against Qt | 4.8.7 | Running against Qt | 4.8.7 Compiled against GDAL/OGR | 2.3.0 | Running against GDAL/OGR | 2.3.0 Compiled against GEOS | 3.6.2-CAPI-1.10.2 | Running against GEOS | 3.6.2-CAPI-1.10.2 4d2925d6 PostgreSQL Client Version | 10.4 (Debian 10.4-2) | SpatiaLite Version | 4.3.0a QWT Version | 6.1.3 | PROJ.4 Version | 510 QScintilla2 Version | 2.10.4 |   |  

No workaround?

RyanThomas commented 5 years ago

Ubuntu 18.04, QGIS 2.18 here. Is there no solution to this? The same error comes from QuickOSM plugin. I am wondering if the solution here would work for my issue as well.: Couldn't load plugin QuickOSM due to an error when calling its classFactory() method

ImportError: cannot import name QtWebKit Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 333, in startPlugin plugins[packageName] = package.classFactory(iface) File "/home/ryan/.qgis2/python/plugins/QuickOSM/init.py", line 27, in classFactory from quick_osm import QuickOSM File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/home/ryan/.qgis2/python/plugins/QuickOSM/quick_osm.py", line 34, in from QuickOSM.ui.main_window_dialog import MainWindowDialog File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/home/ryan/.qgis2/python/plugins/QuickOSM/ui/main_window_dialog.py", line 28, in from main_window import Ui_ui_main_window File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/home/ryan/.qgis2/python/plugins/QuickOSM/ui/main_window.py", line 431, in from PyQt4 import QtWebKit ImportError: cannot import name QtWebKit

Python version: 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0] QGIS version: 2.18.17 Las Palmas, exported

Python Path: /usr/share/qgis/python/plugins/processing /usr/share/qgis/python /home/ryan/.qgis2/python /home/ryan/.qgis2/python/plugins /usr/share/qgis/python/plugins /usr/lib/python2.7 /usr/lib/python2.7/plat-x86_64-linux-gnu /usr/lib/python2.7/lib-tk /usr/lib/python2.7/lib-old /usr/lib/python2.7/lib-dynload /home/ryan/.local/lib/python2.7/site-packages /usr/local/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages /usr/lib/python2.7/dist-packages/gtk-2.0 /usr/lib/python2.7/dist-packages/wx-3.0-gtk3 /home/ryan/.qgis2//python .

climu commented 5 years ago

Just want to say I am affected also on ubuntu 18.04 and qgis 2.18.17.

answerquest commented 5 years ago

workaround tip: QuickMapServices : an alternate plugin that's doing the job of putting baselayers and working on QGIS 2.18.17 on my Lubuntu 18.04 64-bit system. Got the tip on https://gis.stackexchange.com/a/131501/44746

pka commented 5 years ago

The Python bindings of libqtwebkit4 have been removed in Debian Sid and Ubuntu 18.04. QGIS packages from qgis.org now include these Python bindings. So installing python-qgis from qgis.org together with libqtwebkit4 should solve this problem for plugins requiring qtwebkit (LRS, MultiEdit, OpenLayers, qgis2web, QuickOSM, Statist, WFS 2.0 client, WPS client and others).

VincentLeclercq commented 5 years ago

Despite the installation of libqtwebkit4 , the open layer plugin can't be installed on my pc (ubuntu 18.04) Even after reset/restart.

How is it possible?

tvoirand commented 5 years ago

Same here, I installed QGIS 2.18.17 from qgis.org on Ubuntu 18.04, and I installed libqtwebkit4. I still can't import PyQt4.QtWebKit and install the OpenLayers plugin.

TheGrave-zz commented 5 years ago

Ongoing with 2.18.28 on Ubuntu 18.04 and all suggestions above tested.

Workaround for Google Maps (Terrain layer is screwed but the rest is fine):

https://geogeek.xyz/how-to-add-google-maps-layers-in-qgis-3.html

PierreChaProt commented 5 years ago

Same problem here with QGIS 2.18.17 on Ubuntu 18.04.2 LTS and libqtwebkit4 installed. Here's what I get:

ImportError: cannot import name QtWebKit

Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 333, in startPlugin plugins[packageName] = package.classFactory(iface) File "/home/pierre/.qgis2/python/plugins/openlayers_plugin/init.py", line 25, in classFactory from openlayers_plugin import OpenlayersPlugin File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/home/pierre/.qgis2/python/plugins/openlayers_plugin/openlayers_plugin.py", line 30, in from openlayers_overview import OLOverview File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/home/pierre/.qgis2/python/plugins/openlayers_plugin/openlayers_overview.py", line 23, in from openlayers_ovwidget import OpenLayersOverviewWidget File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/home/pierre/.qgis2/python/plugins/openlayers_plugin/openlayers_ovwidget.py", line 38, in from ui_openlayers_ovwidget import Ui_Form File "/usr/lib/python2.7/dist-packages/qgis/utils.py", line 607, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "/home/pierre/.qgis2/python/plugins/openlayers_plugin/ui_openlayers_ovwidget.py", line 80, in from PyQt4 import QtWebKit ImportError: cannot import name QtWebKit

hammedb197 commented 4 years ago

anyone found fix for this yet?

HakunaMarthata commented 3 years ago

Has anyone found a solution or workaround for this Problem? (I cant switch to QGIS 3 because I need a Plugin that's not available for QGIS 3)