Openshot not opening in Ubuntu 18.04, No module named PyQt5.QtWebKitWidgets
I installed Openshot in Ubuntu 18.04 LTS with
sudo apt-get install openshot-qtAnd when I try to open it with openshot-qt in terminal it fails with an error :
Traceback (most recent call last): File "/usr/bin/openshot-qt", line 11, in <module> load_entry_point('openshot-qt==2.5.1.dev2', 'gui_scripts', 'openshot-qt')() File "/usr/lib/python3/dist-packages/openshot_qt/launch.py", line 97, in main app = OpenShotApp(argv) File "/usr/lib/python3/dist-packages/openshot_qt/classes/app.py", line 220, in __init__ from windows.main_window import MainWindow File "/usr/lib/python3/dist-packages/openshot_qt/windows/main_window.py", line 45, in <module> from windows.views.timeline_webview import TimelineWebView File "/usr/lib/python3/dist-packages/openshot_qt/windows/views/timeline_webview.py", line 42, in <module> from PyQt5.QtWebKitWidgets import QWebView
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'I tried sudo apt-get install python3-pyqt5.qtwebengine according to this question. But opening openshot gives the same error, though the about command gives :
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pyqt5.qtwebengine is already the newest version (5.10.1+dfsg-1ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 50 not upgraded.Can somebody please give the solution?
EDIT:
Output of apt-cache policy python3-pyqt5.qtwebkit :
python3-pyqt5.qtwebkit: Installed: 5.10.1+dfsg-1ubuntu2 Candidate: 5.10.1+dfsg-1ubuntu2 Version table: *** 5.10.1+dfsg-1ubuntu2 500 500 bionic/universe amd64 Packages 100 /var/lib/dpkg/statusOutput of ls -l /usr/lib/python3/dist-packages/PyQt5/ :
-rw-r--r-- 1 root root 826 Feb 27 2018 __init__.py
drwxr-xr-x 2 root root 4096 Sep 15 2019 __pycache__
-rw-r--r-- 1 root root 237384 Apr 23 2018 _QOpenGLFunctions_2_0.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 241624 Apr 23 2018 _QOpenGLFunctions_2_1.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 122296 Apr 23 2018 _QOpenGLFunctions_4_1_Core.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 2955992 Apr 23 2018 QtCore.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 370919 Apr 23 2018 QtCore.pyi
-rw-r--r-- 1 root root 6120 Apr 23 2018 Qt.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 212696 Apr 23 2018 QtDBus.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 22776 Apr 23 2018 QtDBus.pyi
-rw-r--r-- 1 root root 332392 Apr 23 2018 QtDesigner.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 22328 Apr 23 2018 QtDesigner.pyi
-rw-r--r-- 1 root root 3287320 Apr 23 2018 QtGui.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 382629 Apr 23 2018 QtGui.pyi
-rw-r--r-- 1 root root 157560 Apr 23 2018 QtHelp.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 9226 Apr 23 2018 QtHelp.pyi
-rw-r--r-- 1 root root 698304 Apr 23 2018 QtMultimedia.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 83508 Apr 23 2018 QtMultimedia.pyi
-rw-r--r-- 1 root root 102848 Apr 23 2018 QtMultimediaWidgets.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 4571 Apr 23 2018 QtMultimediaWidgets.pyi
-rw-r--r-- 1 root root 859448 Apr 23 2018 QtNetwork.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 94874 Apr 23 2018 QtNetwork.pyi
-rw-r--r-- 1 root root 143192 Apr 23 2018 QtOpenGL.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 15653 Apr 23 2018 QtOpenGL.pyi
-rw-r--r-- 1 root root 239720 Apr 23 2018 QtPrintSupport.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 19835 Apr 23 2018 QtPrintSupport.pyi
-rw-r--r-- 1 root root 104528 Apr 23 2018 QtSvg.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 5909 Apr 23 2018 QtSvg.pyi
-rw-r--r-- 1 root root 103104 Apr 23 2018 QtTest.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 10827 Apr 23 2018 QtTest.pyi
-rw-r--r-- 1 root root 33920 Apr 23 2018 QtWebChannel.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 2480 Apr 23 2018 QtWebChannel.pyi
-rw-r--r-- 1 root root 67992 Apr 23 2018 QtWebEngineCore.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 7141 Apr 23 2018 QtWebEngineCore.pyi
-rw-r--r-- 1 root root 54304 Apr 23 2018 QtWebEngine.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 6582 Apr 23 2018 QtWebEngine.pyi
-rw-r--r-- 1 root root 239800 Apr 23 2018 QtWebEngineWidgets.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 32973 Apr 23 2018 QtWebEngineWidgets.pyi
-rw-r--r-- 1 root root 170264 Apr 23 2018 QtWebKit.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 18340 Apr 23 2018 QtWebKit.pyi
-rw-r--r-- 1 root root 317720 Apr 23 2018 QtWebKitWidgets.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 32123 Apr 23 2018 QtWebKitWidgets.pyi
-rw-r--r-- 1 root root 5498280 Apr 23 2018 QtWidgets.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 500483 Apr 23 2018 QtWidgets.pyi
-rw-r--r-- 1 root root 315744 Apr 23 2018 QtXml.cpython-36m-x86_64-linux-gnu.so
-rw-r--r-- 1 root root 27507 Apr 23 2018 QtXml.pyi
drwxr-xr-x 7 root root 4096 Sep 15 2019 uicOutput of python3 -c "import PyQt5.QtWebKitWidgets" :
Traceback (most recent call last): File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets' 8 1 Answer
It's worth understanding what's happening here as the solution seems counter intuitive:
openshot-qtis written in Python and requires thePyQt5.QtWebKitWidgetsmodule which is provided by the Ubuntu packagepython3-pyqt5.qtwebkit.- All Python modules installed by
aptget installed into/usr/lib/python3/dist-packages. - All Python modules installed by the Python package management tools (e.g.
pip) get installed into/usr/local/lib/python3.6/dist-packages. There are exceptions to this rule like when using virtualenv but that's not applicable here. - If a package exists in both
/usr/local/lib/python3.6/dist-packagesand/usr/lib/python3/dist-packages, the version in/usr/local/lib/python3.6/dist-packagestakes precedence (this is the version installed bypip). - This one is important:
PyQt5removedQtWebKitWidgetssupport in v5.6 in their distribution. Ubuntu appears to have kept custom support for it in their v5.10 package.- It appears the version installed in
/usr/local/lib/python3.6/dist-packagesis >= v5.6
- It appears the version installed in
So your problem is that there is a newer version of PyQt5 installed without the module you need that is essentially overriding Ubuntu's version that has the module you need. The solution is then to remove the newer version so your system will use the Ubuntu-supplied version. You can do this by running sudo pip3 uninstall pyqt5. After doing so, confirm that the directory /usr/local/lib/python3.6/dist-packages/PyQt5 is gone.
There is a chance some non-apt controlled program actually needs the newer version of PyQt5 but this sort of situation is what virtualenv is for.