Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

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 https://www.qt.io/product/features 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 https://doc.qt.io/qtforpython-6/api.html it seems that QtWebEngineWidgets is taken for granted, but in the complete list it does not appear at all https://doc.qt.io/qtforpython-6/modules.html and in here also https://doc.qt.io/qt-6/qtmodules.html.
    • 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

    Remark:

    # 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/__init__.py)
    or
    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!


Log in to reply