retext-project/retext

ReText crashes after PyQt5, PyQtWebEngine upgrade

mderouss opened this issue · 4 comments

Hello,

because I was having similar issues to those noted in #578, I upgraded packages as per the advice in that issue :

mark@z800:~$ pip3 install --upgrade PyQt5 PyQtWebEngine
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: PyQt5 in /usr/lib/python3/dist-packages (5.15.6)
Collecting PyQt5
  Downloading PyQt5-5.15.9-cp37-abi3-manylinux_2_17_x86_64.whl (8.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.4/8.4 MB 7.3 MB/s eta 0:00:00
Collecting PyQtWebEngine
  Downloading PyQtWebEngine-5.15.6-cp37-abi3-manylinux1_x86_64.whl (230 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 230.4/230.4 KB 5.9 MB/s eta 0:00:00
Collecting PyQt5-Qt5>=5.15.2
  Downloading PyQt5_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl (59.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 59.9/59.9 MB 6.7 MB/s eta 0:00:00
Collecting PyQt5-sip<13,>=12.11
  Downloading PyQt5_sip-12.12.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.whl (360 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 360.5/360.5 KB 6.7 MB/s eta 0:00:00
Collecting PyQtWebEngine-Qt5>=5.15.0
  Downloading PyQtWebEngine_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl (67.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 67.5/67.5 MB 7.0 MB/s eta 0:00:00
Installing collected packages: PyQtWebEngine-Qt5, PyQt5-Qt5, PyQt5-sip, PyQt5, PyQtWebEngine
Successfully installed PyQt5-5.15.9 PyQt5-Qt5-5.15.2 PyQt5-sip-12.12.1 PyQtWebEngine-5.15.6 PyQtWebEngine-Qt5-5.15.2

Now, whenever I try to switch to Webkit rendering, ReText dies. I'm using :

ReText 7.2.3 (using PyMarkups 3.1.3)

About Qt
This program uses Qt version 5.15.2.

When I turn on exception logging as follows :

#!/usr/bin/python3

import sys
import logging

sys.path.insert(0, '/usr/share/retext')

from ReText.__main__ import main

if __name__ == '__main__':
    try:
        main()
    except Exception:
        logging.exception("ReTest crash")

I get :

Using configuration file: /home/mark/.config/ReText project/ReText.conf
Cannot mix incompatible Qt library (5.15.3) with this library (5.15.2)
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/share/retext/ReText/converterprocess.py", line 72, in _converter_process_func
    job = receiveObject(conn_child)
  File "/usr/share/retext/ReText/converterprocess.py", line 41, in receiveObject
    sizeBuf = recvall(sock, 4)
  File "/usr/share/retext/ReText/converterprocess.py", line 34, in recvall
    raise EOFError('Received 0 bytes from socket while more bytes were expected. Did the sender process exit unexpectedly?')
EOFError: Received 0 bytes from socket while more bytes were expected. Did the sender process exit unexpectedly?
Aborted (core dumped)

But now I'm just confused, because I do not know where 5.15.3 has come from - it is not mentioned in the upgrade output ???.

Note that WebKit and WebEngine are two different renderers. ReText 7.x prefers WebKit. And if you have WebKit installed from your distro and PyQt is from PyPI, they may be incompatible.

I can suggest these options:

  • Remove everything from ~/.local/lib/python3.10/dist-packages and rely on packages provided by distro.

  • Or: use a virtualenv (e.g. using virtualenvwrapper Debian package) and install ReText in that environment. This way it should interfere less with distro packages. Also, that will pick ReText 8.x which uses PyQt6 (which will bring newer Chromium code base and thus maybe better Unicode support).

  • Or: keep your configuration but try removing distro python3-pyqt5.qtwebkit package. This is the less preferred option, because other packages may still cause conflict.

Thanks for the quick response ! I already tried removing everything and installing ReText 8 via pip3 as per the instructions in README ( not using a virtualenv ). This was even worse - when I do this, I don't get an exception, just a cryptic message that says something like -

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

To be honest, chasing down and fixing dependency hell problems with Qt and Python is not what I need to be doing right now, I need to be editing Markdown, so I may come back to this and try some of your suggestions at some less critical time. 7 looked promising until I broke it, but right now I'll revert to ghostwriter which kind-of works even though they broke some important things long ago in 2.0 ( the main reason I started looking for alternatives ).

Thanks,
Mark

No action required.

qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.

Qt 6's xcb plugin has some new library dependencies compared to Qt 5. In particular, it needs libxcb-shape0 and libxcb-cursor0. Pip cannot install library packages for you. You can do that yourself using the following commands:

sudo apt install libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-cursor0 libxcb-xinerama0
sudo apt install libegl1-mesa libxkbcommon-x11-0

This is why my first suggestion was relying on packages provided by the distro — there would be no such problems there.