1

I installed Openshot in Ubuntu 18.04 LTS with

sudo apt-get install openshot-qt

And 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 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
        100 /var/lib/dpkg/status

Output 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 uic

Output of python3 -c "import PyQt5.QtWebKitWidgets" :

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'PyQt5.QtWebKitWidgets'

Roshin Raphel
  • 123
  • 14

1 Answers1

2

It's worth understanding what's happening here as the solution seems counter intuitive:

  • openshot-qt is written in Python and requires the PyQt5.QtWebKitWidgets module which is provided by the Ubuntu package python3-pyqt5.qtwebkit.
  • All Python modules installed by apt get 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-packages and /usr/lib/python3/dist-packages, the version in /usr/local/lib/python3.6/dist-packages takes precedence (this is the version installed by pip).
  • This one is important: PyQt5 removed QtWebKitWidgets support 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-packages is >= v5.6

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.

Brian Turek
  • 1,786
  • 6
  • 12