3

When installing the plugin qgis2web through the plugin manager on the qgis 2.99 nightly release I get the following error message. Does anyone know what I need to do to get it working. I've not seen an obvious corresponding issue on the github repo.

Couldn't load plugin 'qgis2web' due to an error when calling its classFactory() method 

ImportError: No module named 'PyQt5.QtWebKitWidgets' 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 336, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "/home/will/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis2web/__init__.py", line 28, in classFactory
    from .qgis2web import Qgis2Web
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 664, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/will/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis2web/qgis2web.py", line 30, in 
    from qgis2web.maindialog import MainDialog
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 664, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/home/will/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis2web/maindialog.py", line 55, in 
    from qgis.PyQt.QtWebKitWidgets import QWebView, QWebInspector, QWebPage
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 664, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "/usr/lib/python3/dist-packages/qgis/PyQt/QtWebKitWidgets.py", line 26, in 
    from PyQt5.QtWebKitWidgets import *
  File "/usr/lib/python3/dist-packages/qgis/utils.py", line 664, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: No module named 'PyQt5.QtWebKitWidgets'


Python version: 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] 
QGIS version: 2.99.0-Master Master, 585a4d3 

Python Path:
/home/will/.local/share/QGIS/QGIS3/profiles/default/python/plugins/gml_application_schema_toolbox/extlibs
/usr/share/qgis/python
/home/will/.local/share/QGIS/QGIS3/profiles/default/python
/home/will/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python35.zip
/usr/lib/python3.5
/usr/lib/python3.5/plat-x86_64-linux-gnu
/usr/lib/python3.5/lib-dynload
/home/will/.local/lib/python3.5/site-packages
/usr/local/lib/python3.5/dist-packages
/usr/lib/python3/dist-packages
/home/will/.local/share/QGIS/QGIS3/profiles/default/python
2
  • 1
    Did you check if you have PyQt5 installed?
    – Piskr
    Feb 23, 2018 at 13:14
  • I can run import PyQt 5 in the python console, but import PyQt 5.QtWebKitWidgets throws and error.
    – RoperMaps
    Feb 23, 2018 at 16:38

2 Answers 2

6

The missing module is 'PyQt5.QtWebKitWidgets' which can be installed on ubuntu as part of the 'python3-pyqt5.qtwebkit' deb package.

To check if it is already installed, and ensure it is available, the command is:

apt-cache policy python3-pyqt5.qtwebkit

Assuming it isn't installed, then it can be installed with:

sudo apt install python3-pyqt5.qtwebkit

@TomChadwin put me on the right track.

2

I don't know what distribution you are on, but this is likely to be the availability of QtWebkit, or its Python bindings. See if you can ensure they are installed.

7
  • Thanks Tom. Should this be as part of the qgis install, or should they be somewhere separate? When you say 'distribution' do you mean of qgis2web?
    – RoperMaps
    Feb 23, 2018 at 16:39
  • I believe he<s referring to your Linux distribution or your OS. It may be the case that Ubuntu/CentOS/etc. doesn't include the latest version of QtWebkit5 or include more recent Python bindings for it. This is particularly true for LTS distributions (e.g. Ubuntu Xenial or Debian Jessie). Feb 23, 2018 at 16:55
  • Thanks! Slow going with QGIS on ubuntu so appreciate the help. I'm on Ubuntu Xenial, I installed QGIS with http://qgis.org/ubuntugis-nightly xenial main and http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu xenial main ppa repositories. So assumed they handled dependencies. How would I check for the QtWebKit5/it's python bindings?
    – RoperMaps
    Feb 23, 2018 at 17:26
  • 1
    I didn't give details because I'm not much of a Linux user either. Your edit would have made it look as though I knew things I don't. Feb 24, 2018 at 23:27
  • 1
    @RoperMaps think of self-answering your question.
    – AndreJ
    Feb 25, 2018 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.