1

I am trying to develop some pyqt applications on chromeOS. However, some errors kept occurring during installation. I tried two ways, first with conda, later install the packages directly. No error appears during installing with conda, but when I try to run, this error appeared

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.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted (core dumped)

Later I also tried to install pyqt directly, yet, this time I cannot install

$ pip3 install pyqt5
Collecting pyqt5
  Downloading https://files.pythonhosted.org/packages/8e/a4/d5e4bf99dd50134c88b95e926d7b81aad2473b47fde5e3e4eac2c69a8942/PyQt5-5.15.4.tar.gz (3.3MB)
    100% |████████████████████████████████| 3.3MB 316kB/s 
  Installing build dependencies ... done
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/usr/lib/python3.7/tokenize.py", line 447, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-install-erarrdoj/pyqt5/setup.py'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-erarrdoj/pyqt5/

Edit: I try QT_DEBUG_PLUGINS=1 python script.py The output is very long, yet I guess this part tells the error:

QFactoryLoader::QFactoryLoader() checking directory path "/home/$USER/anaconda3/envs/pyqt/bin/platforms" ...
Cannot load library /home/$USER/anaconda3/envs/pyqt/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-util.so.1: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/$USER/anaconda3/envs/pyqt/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so" : "Cannot load library /home/$USER/anaconda3/envs/pyqt/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-util.so.1: cannot open shared object file: No such file or directory)"
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.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

Aborted (core dumped)

I tried to fix this problem by $ conda install -c conda-forge xcb-util However, same error still occurs.

QFactoryLoader::QFactoryLoader() checking directory path "/home/$USER/anaconda3/envs/pyqt_env/bin/platforms" ...
Cannot load library /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-util.so.1: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so" : "Cannot load library /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-util.so.1: cannot open shared object file: No such file or directory)"
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.

I then checked the files in /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/ Weirdly I only found

libqeglfs.so    libqminimalegl.so  libqoffscreen.so  libqwayland-egl.so      libqwayland-xcomposite-egl.so  libqwebgl.so
libqlinuxfb.so  libqminimal.so     libqvnc.so        libqwayland-generic.so  libqwayland-xcomposite-glx.so  libqxcb.so

I install pyqt on Windows with the same method, it works. Would it just be a chromeOS problem?

And the results for ldd /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so is:

        linux-vdso.so.1 (0x00007ffff18ed000)
        libQt5XcbQpa.so.5 => /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5XcbQpa.so.5 (0x00007c3b4b564000)
        libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007c3b4b50e000)
        libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007c3b4b452000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007c3b4b234000)
        libQt5Gui.so.5 => /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5Gui.so.5 (0x00007c3b4a903000)
        libQt5DBus.so.5 => /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5DBus.so.5 (0x00007c3b4a675000)
        libQt5Core.so.5 => /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5Core.so.5 (0x00007c3b49e7f000)
        libGL.so.1 => /usr/lib/x86_64-linux-gnu/libGL.so.1 (0x00007c3b49deb000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007c3b49dca000)
        libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007c3b49dc5000)
        libxcb-icccm.so.4 => /usr/lib/x86_64-linux-gnu/libxcb-icccm.so.4 (0x00007c3b49dbe000)
        libxcb-image.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-image.so.0 (0x00007c3b49bb7000)
        libxcb-shm.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0 (0x00007c3b49bb2000)
        libxcb-util.so.1 => not found
        libxcb-keysyms.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-keysyms.so.1 (0x00007c3b499af000)
        libxcb-randr.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-randr.so.0 (0x00007c3b4999d000)
        libxcb-render-util.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render-util.so.0 (0x00007c3b49799000)
        libxcb-render.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-render.so.0 (0x00007c3b49788000)
        libxcb-shape.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-shape.so.0 (0x00007c3b49783000)
        libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007c3b49779000)
        libxcb-xfixes.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xfixes.so.0 (0x00007c3b4976f000)
        libxcb-xinerama.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-xinerama.so.0 (0x00007c3b4976a000)
        libxcb-xkb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007c3b4974c000)
        libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007c3b49720000)
        libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007c3b4950e000)
        libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007c3b493cd000)
        libxkbcommon-x11.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon-x11.so.0 (0x00007c3b493c2000)
        libxkbcommon.so.0 => /usr/lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007c3b49380000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007c3b4937b000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007c3b491f5000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007c3b49072000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007c3b49058000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007c3b48e97000)
        libxcb-util.so.1 => not found
        libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007c3b48e92000)
        libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007c3b48d71000)
        libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007c3b48d34000)
        libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007c3b48d2b000)
        libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007c3b48cf2000)
        libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007c3b48c9f000)
        libicui18n.so.56 => /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libicui18n.so.56 (0x00007c3b48804000)
        libicuuc.so.56 => /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libicuuc.so.56 (0x00007c3b4844c000)
        libicudata.so.56 => /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libicudata.so.56 (0x00007c3b46a69000)
        /lib64/ld-linux-x86-64.so.2 (0x00007c3b4bac3000)
        libGLX.so.0 => /usr/lib/x86_64-linux-gnu/libGLX.so.0 (0x00007c3b46a35000)
        libGLdispatch.so.0 => /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007c3b46978000)
        libxcb-util.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-util.so.0 (0x00007c3b4676f000)
        libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007c3b4656b000)
        libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007c3b46365000)
        libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007c3b462f1000)
        libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007c3b4624e000)
        libbsd.so.0 => /usr/lib/x86_64-linux-gnu/libbsd.so.0 (0x00007c3b46234000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007c3b4622a000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007c3b46202000)
        liblz4.so.1 => /usr/lib/x86_64-linux-gnu/liblz4.so.1 (0x00007c3b461e3000)
        libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007c3b460c5000)
        libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007c3b460a0000)
HAO LEE
  • 153
  • 3
  • 13
  • what is the output of `QT_DEBUG_PLUGINS=1 python script.py`? – eyllanesc Aug 29 '21 at 22:09
  • From looking at other people with this error, it sounds like you might have multiple versions of Qt installed. You should make sure you *only* use the system version if at all possible. – o11c Aug 29 '21 at 22:19
  • @eyllanesc I tried and the output is shown in the edit, any suggestion? – HAO LEE Aug 29 '21 at 23:56
  • @HAOLEE execute `conda install -c conda-forge xcb-util` – eyllanesc Aug 30 '21 at 00:01
  • @eyllanesc after reinstall xcb-util, same error still – HAO LEE Aug 30 '21 at 00:28
  • @HAOLEE Execute the command `QT_DEBUG_PLUGINS=1 python script.py` and copy the new error message, in your initial message it says: *Cannot load library /home/$USER/anaconda3/envs/pyqt/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-util.so.1: cannot open shared object file: No such file or directory)* – eyllanesc Aug 30 '21 at 00:30
  • @eyllanesc I did but still the same issue...... – HAO LEE Aug 30 '21 at 01:00
  • what is the output of `ldd /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so`? – eyllanesc Aug 30 '21 at 01:05
  • @eyllanesc some of the files are missing...... no matter how many times I reinstall the library. – HAO LEE Aug 30 '21 at 03:16
  • execute `sudo apt install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev` OR `sudo apt-get install '.*xcb.*'` – eyllanesc Aug 30 '21 at 03:19
  • @eyllanesc still libxcb-util.so.1 => not found – HAO LEE Aug 31 '21 at 03:40

1 Answers1

1

Thank you for @eyllanesc help. After running my .py with QT_DEBUG_PLUGINS=1 and ldd /home/$USER/anaconda3/envs/pyqt_env/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so

It turned out that libxcb-util.so.1 => not found

any apt install or apt update cannot solve this problem. In the end I have to download the debian package from

https://packages.debian.org/bullseye/amd64/libxcb-util1/download

and do sudo dpkg -i *.deb to manually install it.

HAO LEE
  • 153
  • 3
  • 13