ImportError: No module named 'PyQt5.QtWebKit'

Bug #1732695 reported by bendikro
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
retext (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

After installing retext (5.3.1-1) on 16.04.3, starting retext gives the following trace:

Traceback (most recent call last):
  File "/usr/bin/retext", line 23, in <module>
    from ReText.window import ReTextWindow
  File "/usr/share/retext/ReText/window.py", line 22, in <module>
    from ReText.tab import ReTextTab, PreviewNormal, PreviewLive
  File "/usr/share/retext/ReText/tab.py", line 32, in <module>
    from PyQt5.QtWebKit import QWebSettings
ImportError: No module named 'PyQt5.QtWebKit'

bendikro (bendikro)
description: updated
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

That should not happen because retext depends on python3-pyqt5.qtwebkit. Maybe you have a custom PyQt5 installation somewhere that does not have Qt WebKit support?

Changed in retext (Ubuntu):
status: New → Incomplete
Revision history for this message
Marco Scavazzon (marco-skv) wrote :

Same problem here

marco@ubuntu:~$ retext
Using configuration file: /home/marco/.config/ReText project/ReText.conf
Traceback (most recent call last):
  File "/usr/bin/retext", line 23, in <module>
    from ReText.window import ReTextWindow
  File "/usr/share/retext/ReText/window.py", line 22, in <module>
    from ReText.tab import ReTextTab, PreviewNormal, PreviewLive
  File "/usr/share/retext/ReText/tab.py", line 32, in <module>
    from PyQt5.QtWebKit import QWebSettings
ImportError: No module named 'PyQt5.QtWebKit'

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Marco: please see my comment above. Do you have python3-pyqt5.qtwebkit package installed? Do you have any packages installed using pip?

Revision history for this message
Marco Scavazzon (marco-skv) wrote :

Hi Dmitry

I don't have a custom PyQT5 installation on my laptop. I tried to reinstall the package python3-pyqt5.qtwebkit without success (still same error). The version installed is 5.5.1+dfsg-3ubuntu4

I have installed packages with pip, but only within virtualenv, not for the system python.

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Hi Marco, thanks for your feedback.

Can you please open a terminal, launch python3 there, enter these lines and paste the output?

>>> import PyQt5
>>> PyQt5.__path__
>>> import PyQt5.QtCore
>>> PyQt5.QtCore.__file__
>>> import PyQt5.QtWebKit

(lines 2 and 4 should print some paths; line 5 may either succeed or print an exception).

Revision history for this message
Marco Scavazzon (marco-skv) wrote :

Thanks for your help.
Here is the output

marco@ubuntu:~$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyQt5
>>> PyQt5.__path__
['/home/marco/.local/lib/python3.5/site-packages/PyQt5']
>>> import PyQt5.QtCore
>>> PyQt5.QtCore.__file__
'/home/marco/.local/lib/python3.5/site-packages/PyQt5/QtCore.so'
>>> import PyQt5.QtWebKit
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'PyQt5.QtWebKit'

Is it normal to have such libraries in a hidden virtualenv within the home dir?

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

> /home/marco/.local/lib/python3.5/site-packages/PyQt5

This means you *do* have a local PyQt5 installation. It is not a virtualenv and this directory is in global Python search path. Delete this directory and ReText should start working.

If you have some local code that needs a custom PyQt5, then use a virtualenv for it.

I am closing this bug as it happens only when a custom PyQt5 installed, and there is no way to fix this. This bug should no longer happen with ReText 6.0 or newer, as WebKit support became optional there.

Changed in retext (Ubuntu):
status: Incomplete → Invalid
Revision history for this message
Marco Scavazzon (marco-skv) wrote :

Thanks a lot Dmitry. Just one question, do you know what has created that python 3 site-packages directory? Is it a feature of python3?

Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Most probably you ran pip3 install something, and that pulled in PyQt5. Check what else is in your /home/marco/.local/lib/python3.5/site-packages/ and in /home/marco/.local/bin/ and you will see what it was.

Revision history for this message
Marco Scavazzon (marco-skv) wrote :

Too late (I already deleted them to use retext). Anyway, many thanks for your help!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.