You must have either QT or GTK with Python extensions installed in order to use pywebview.
i get this error, even though ive installed all required dependencies for both qt and gtk.
webview.util.WebViewException: You must have either QT or GTK with Python extensions installed in order to use pywebview.
[pywebview] GTK cannot be loaded
Traceback (most recent call last):
File "/home/zyugyzarc/.local/lib/python3.9/site-packages/webview/guilib.py", line 16, in import_gtk
import webview.platforms.gtk as guilib
File "/home/zyugyzarc/.local/lib/python3.9/site-packages/webview/platforms/gtk.py", line 28, in <module>
gi.require_version('WebKit2', '4.0')
File "/usr/lib/python3/dist-packages/gi/__init__.py", line 126, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace WebKit2 not available
[pywebview] Using Qt 5.15.2
[pywebview] QT cannot be loaded
Traceback (most recent call last):
File "/home/zyugyzarc/.local/lib/python3.9/site-packages/webview/platforms/qt.py", line 38, in <module>
from PyQt5.QtWebEngineWidgets import QWebEngineView as QWebView, QWebEnginePage as QWebPage
ImportError: /home/zyugyzarc/.local/lib/python3.9/site-packages/PyQt5/Qt5/lib/libQt5WebEngineCore.so.5: undefined symbol: _ZNSt12out_of_rangeC1EPKc, version Qt_5
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zyugyzarc/.local/lib/python3.9/site-packages/webview/guilib.py", line 29, in import_qt
import webview.platforms.qt as guilib
File "/home/zyugyzarc/.local/lib/python3.9/site-packages/webview/platforms/qt.py", line 43, in <module>
from PyQt5 import QtWebKitWidgets
ImportError: cannot import name 'QtWebKitWidgets' from 'PyQt5' (/usr/lib/python3/dist-packages/PyQt5/__init__.py)
Traceback (most recent call last):
File "/home/zyugyzarc/Documents/hydra/main.py", line 119, in <module>
webview.start(app.onready, window, gui="cef", debug=True)
File "/home/zyugyzarc/.local/lib/python3.9/site-packages/webview/__init__.py", line 122, in start
guilib = initialize(gui)
File "/home/zyugyzarc/.local/lib/python3.9/site-packages/webview/guilib.py", line 93, in initialize
raise WebViewException('You must have either QT or GTK with Python extensions installed in order to use pywebview.')
webview.util.WebViewException: You must have either QT or GTK with Python extensions installed in order to use pywebview.
also i found this, might be relevant https://stackoverflow.com/questions/37876987/cannot-import-qtwebkitwidgets-in-pyqt5
Practicalities
YES/NO I am willing to work on this issue myself.: no
YES/NO I am prepared to support this issue financially.: no
sudo apt-get install build-essential libgl1-mesa-dev
pip3 install pyqt5 pyqtwebengine
pip3 install pywebview
pip3 install pywebview[qt]
This discussion may be of help. https://forum.qt.io/topic/127736/pyqt5-qtwebenginewidgets-importerror/9
Please report back if you get it working