13

I try to run a python script using PyQt5 QtWebEngineWidgets but it throws errors:

  from PyQt5.QtWebEngineWidgets import (
ImportError: No module named 'PyQt5.QtWebEngineWidgets'

I think there is a package missing but which one? python3-pyqt5.qtwebkit is installed.

How to get this working?

6

I'm not 100% certain that this addresses the OP's error message, but at least for Ubuntu 17.04 I have successfully run:

apt-get install python3-pyqt5.qtwebengine

This brings in loads of dependencies, including libqt5webenginecore5, libqt5webenginewidgets5, python3-pyqt5.qtwebchannel and python3-pyqt5.qtwebengine.

I do not know how this relates to @The Compiler's answer of QtWebEngine not being packaged for Ubuntu, but it worked for me without any compiling of Qt/PyQt.

| improve this answer | |
  • This solved my problem of using Anki flashcard on Debian – zhazha Feb 2 '18 at 7:26
  • I've tagged 16.04 so it's not exactly the answer but good to know, it's available in current LTS release (18.04 does have it too). – Michael Nov 20 '18 at 8:13
4

The script needs QtWebEngine, not QtWebKit.

Unfortunately, that's not packaged for Debian/Ubuntu, so the only way you would get that running is to compile Qt and PyQt on your own (which can be a bit of a pain).

| improve this answer | |
  • I think so too... :( – Michael Apr 28 '16 at 6:39
  • What about for Windows? – Jonathan Feb 11 '17 at 23:32
4

I installed python3-pyqt5.qtmultimedia

sudo apt install python3-pyqt5.qtmultimedia

in Xenial (because python3-pyqt5.qtwebengine was not found, so I searched all patterns matching python3-pyqt5 and apt-cache search found this one among others which seemed relevant to me.

I can now use ffmpegconverter again! (A small one which does great things, which I compiled by hand).

| improve this answer | |
  • But what does this have to do with my question? – Michael Nov 14 '17 at 16:15
3

If you get here and are using pip - I haven't investigated fully but I just got just this when running Anki since the upgrade in pip to PyQT5 5.12. The package sizes for 5.11.3 and 5.12 are vastly different - 5.11.3 weighs in at 118MB and 5.12 at "only" 61MB. Forcing the install of 5.11.3 removed the issue. I'm guessing this is no longer bundled in the PyQT5 in pip, and needs to be installed as a separate requirement.

It's in the release notes, they moved the webengine widgets to a different package. Just run:

pip install PyQtWebEngine
| improve this answer | |
3

I had the same issue, when trying to run Spyder for the first time. I'm using a Miniconda distribution on Mac. I had to install both so that I could lunch Spyder

pip install PyQtWebEngine
pip install PyQt5

I hope this help.

| improve this answer | |
2

If you get here and are using pip - I haven't investigated fully but I just got just this when running Anki since the upgrade in pip to PyQT5 5.12. The package sizes for 5.11.3 and 5.12 are vastly different - 5.11.3 weighs in at 118MB and 5.12 at "only" 61MB. Forcing the install of 5.11.3 removed the issue. I'm guessing this is no longer bundled in the PyQT5 in pip, and needs to be installed as a separate requirement.

pip uninstall PyQt5
pip install PyQt5==5.11.3

(Anki's requirements.txt has now been updated, so pulling the latest from Github should now work)

| improve this answer | |
  • Can you expand your answer and show the commands needed to do this? – Kristopher Ives Feb 26 '19 at 1:12
  • Done, sorry it took so long – AntonOfTheWoods Mar 6 '19 at 3:09
1

I fixed it by running this command:

pip3 uninstall pyqt5

Source: https://bugs.launchpad.net/ubuntu/+source/openshot-qt/+bug/1814520

| improve this answer | |
0

If you're on Windows 10 running 64-bit version of Python 3.8.0, I found this to work:

pip uninstall PyQt5
pip uninstall PyQtWebEngine
pip install PyQt5==5.13
pip install PyQtWebEgine

Now your code will not complain about QtWebEngineWidgets import error.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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