Nominate our 2022 Qt Champions!

Problem with PySide6 and QtWebEngineWidgets module

  • Hi!

    I recently installed PySide6 on my Linux machine, I needed a more than valid reason to finally "ditch" Python 2.7. In particular, I'm interested in handling Web content and then working with QtWebEngineWidgets.
    Up to now each time I have tried to import such module I get back a "ModuleNotFoundError: No module named 'PySide6.QtWebEngineWidgets" error.
    I document myself but I was not able to find a solution... just more confusion! Here some results of my investigations.

    From the description of the official pages it is not clear to me if QtWebEngine is installed by default:

    • the availability and compatibility of Qt Web Engine with my PC is guaranteed by but it appears as "Framework Add-Ons". Does this mean that it has to be installed separately? How do I do that?
    • From this page it seems that QtWebEngineWidgets is taken for granted, but in the complete list it does not appear at all and in here also
    • I also found in the (Linux) folder with the examples '~/.local/lib/python3.8/site-packages/PySide6/examples/webenginewidgets/' but the compiler gives me an error when running one of them [see remark]. For instance just the line
      from PySide6.QtWebEngineWidgets import QWebEnginePage, QWebEngineView
      return me a module not found error.

    Where do you find QtWebEngineWidgets and/or how do you install it? I have no idea on how to move forward... I would appreciate any kind of advice.

    Thanks in advance


    # fully upgraded Linux machine
    # I installad PySide6 via pip:
    pip3 install PySide6
    # check version (and also with some "Hallo world"-type applications)
    python -c "import PySide6; from PySide6 import QtCore; print(PySide6.__version__, PySide6.QtCore.__version__)"
    6.0.0 6.0.0
    # import QWebEngineView
    python -c "import PySide6; from PySide6 import QtWebEngineWidgets;"
    ImportError: cannot import name 'QtWebEngineWidgets' from 'PySide6' (~/.local/lib/python3.8/site-packages/PySide6/
    python -c "from PySide6.QtWebEngineWidgets import QWebEnginePage, QWebEngineView;"
    ModuleNotFoundError: No module named 'PySide6.QtWebEngineWidgets'
    # in the folder '~/.local/lib/python3.8/site-packages/PySide6/' there is no QtWebEngineWidgets file

  • @cards According to Add-on support in Qt 6.0 and beyond QtWebEngine will be introduced in Qt 6.2 so since PySide6 is a Qt6 wrapper then the company will probably not provide that module until PySide6 6.2. So if you want to use QtWebEngine then you must still use PySide2.

  • Hi eyllanesc!

    Thanks for your quick reply! It is with great sadness that I read your reply... Qt6.2 will be released this September/October.

    By the way do you know any PySide2 doc/manual web-pages? (official and not) I have had great difficulty to find some good material to start with.

    Thanks in advance

  • @cards Use the official Qt docs and the examples it provides. It is also recommended that you change the status to SOLVED since IMO with my previous comment you have solved your problem

  • Thanks a lot!

  • If we need wait for Pyside6.2 then why examples exist that use this?

    """PySide6 WebEngineWidgets Example"""

    import sys
    from PySide6.QtCore import QUrl
    from PySide6.QtGui import QIcon
    from PySide6.QtWidgets import (QApplication, QLineEdit,
    QMainWindow, QPushButton, QToolBar)
    from PySide6.QtWebEngineWidgets import QWebEnginePage, QWebEngineView

    Similiar here:

    python -c "import PySide6; from PySide6 import QtCore; print(PySide6.version, PySide6.QtCore.version)"
    6.0.1 6.0.1

    python -c "import PySide6; from PySide6 import QtWebEngineWidgets;"
    Traceback (most recent call last):
    File "<string>", line 1, in <module>
    ImportError: cannot import name 'QtWebEngineWidgets'

    Soo... 6.0.1 have this or not? Coz examples in doc reaching 6.0.1

  • @Bamboleo Because the PySide6 examples are just a literal copy of the PySide2 ones where PySide2 was changed to PySide6 since in general the initial Qt6 is expected to have internal improvements but not in general of the public API

  • @eyllanesc :ModuleNotFoundError: No module named 'PySide2.QtWebKitWidgets'

    how can i resolve it?in ubundu 20.04,python 3.8.5

  • This post is deleted!

Log in to reply