Problem with PySide6 and QtWebEngineWidgets module
-
wrote on 29 Dec 2020, 00:37 last edited by
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 -
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 filewrote on 29 Dec 2020, 00:55 last edited by eyllanesc@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.
-
wrote on 2 Jan 2021, 14:55 last edited by cards 1 Feb 2021, 14:57
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
-
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
wrote on 3 Jan 2021, 01:37 last edited by@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
-
wrote on 3 Jan 2021, 19:49 last edited by
Thanks a lot!
-
wrote on 6 Mar 2021, 23:13 last edited by Bamboleo 3 Jun 2021, 23:21
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, QWebEngineViewSimiliar 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.htmlpython -c "import PySide6; from PySide6 import QtCore; print(PySide6.version, PySide6.QtCore.version)"
6.0.1 6.0.1python -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
-
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, QWebEngineViewSimiliar 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.htmlpython -c "import PySide6; from PySide6 import QtCore; print(PySide6.version, PySide6.QtCore.version)"
6.0.1 6.0.1python -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
wrote on 6 Mar 2021, 23:25 last edited by JKSH 3 Jun 2021, 23:45@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
-
wrote on 30 Jun 2021, 05:24 last edited by samila
@eyllanesc :ModuleNotFoundError: No module named 'PySide2.QtWebKitWidgets'
how can i resolve it?in ubundu 20.04,python 3.8.5
-
@eyllanesc :ModuleNotFoundError: No module named 'PySide2.QtWebKitWidgets'
how can i resolve it?in ubundu 20.04,python 3.8.5
wrote on 1 Jul 2021, 13:01 last edited by cards 7 Jan 2021, 13:04This post is deleted!