Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Problem with PySide6 and QtWebEngineWidgets module

Problem with PySide6 and QtWebEngineWidgets module

Scheduled Pinned Locked Moved Solved Language Bindings
9 Posts 4 Posters 15.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cards
    wrote on last edited by
    #1

    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

    eyllanescE 1 Reply Last reply
    0
    • C cards

      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

      eyllanescE Offline
      eyllanescE Offline
      eyllanesc
      wrote on last edited by eyllanesc
      #2

      @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.

      If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

      1 Reply Last reply
      2
      • C Offline
        C Offline
        cards
        wrote on last edited by cards
        #3

        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

        eyllanescE 1 Reply Last reply
        0
        • C cards

          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

          eyllanescE Offline
          eyllanescE Offline
          eyllanesc
          wrote on last edited by
          #4

          @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

          If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            cards
            wrote on last edited by
            #5

            Thanks a lot!

            1 Reply Last reply
            0
            • B Offline
              B Offline
              Bamboleo
              wrote on last edited by Bamboleo
              #6

              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

              https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/webenginewidgets/simplebrowser/simplebrowser.py

              Similiar here:
              https://doc.qt.io/qtforpython/examples/example_webenginequick__nanobrowser.html
              https://doc.qt.io/qtforpython/examples/example_webenginewidgets__tabbedbrowser.html
              https://doc.qt.io/qtforpython/examples/example_webenginewidgets__simplebrowser.html

              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

              eyllanescE 1 Reply Last reply
              0
              • B Bamboleo

                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

                https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/webenginewidgets/simplebrowser/simplebrowser.py

                Similiar here:
                https://doc.qt.io/qtforpython/examples/example_webenginequick__nanobrowser.html
                https://doc.qt.io/qtforpython/examples/example_webenginewidgets__tabbedbrowser.html
                https://doc.qt.io/qtforpython/examples/example_webenginewidgets__simplebrowser.html

                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

                eyllanescE Offline
                eyllanescE Offline
                eyllanesc
                wrote on last edited by JKSH
                #7

                @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

                If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

                1 Reply Last reply
                1
                • S Offline
                  S Offline
                  samila
                  wrote on last edited by samila
                  #8

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

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

                  C 1 Reply Last reply
                  0
                  • S samila

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

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

                    C Offline
                    C Offline
                    cards
                    wrote on last edited by cards
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved