Trouble Running PyQt5 GUI Application on HPC Server with VNC

Hello everyone,

I’m experiencing an issue when trying to run a PyQt5 application via a VNC session on an HPC server. Here’s a brief rundown of my setup:

  • Environment: HPC cluster with interactive job submission.
  • Command Used: Using VSCODE and code-server for editing, submitted a job with bsub and initiated code-server.
  • GUI Application: A simple PyQt5 application that creates a basic window.

Problem Description:
When I attempt to run the PyQt5 script, I encounter a lengthy series of debug messages related to QFactoryLoader checking and loading platform plugins like libqeglfs.so, libqlinuxfb.so, etc., but it ends without indicating a specific error or failing to open the window. It seems like the application can’t properly initiate the GUI on the server through VNC.

Here is the minimal code snippet of the application:

# example.py
import sys
from PyQt5.QtWidgets import QApplication, QWidget

def main():
    app = QApplication(sys.argv)
    w = QWidget()
    w.resize(250, 150)
    w.move(300, 300)
    w.setWindowTitle('Simple')
    w.show()

    sys.exit(app.exec_())

if __name__ == '__main__':
    main()

And here are the typical messages from running the application:

ot keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/labs/mayalab/barc/.conda/envs/testnewenv/bin/platforms" ...
Cannot load library /home/labs/mayalab/barc/.conda/envs/testnewenv/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-icccm.so.4: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/labs/mayalab/barc/.conda/envs/testnewenv/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so" : "Cannot load library /home/labs/mayalab/barc/.conda/envs/testnewenv/lib/python3.9/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxcb-icccm.so.4: 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.

Reinstalling the application didn’t fix the problem by the way.

OS details

(cellpose) [barc@accessv01 ~]$ hostnamectl
 Static hostname: accessv01.wexac.weizmann.ac.il
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: *************************************
         Boot ID: *************************************
  Virtualization: vmware
Operating System: Red Hat Enterprise Linux 9.1 (Plow)
     CPE OS Name: cpe:/o:redhat:enterprise_linux:9::baseos
          Kernel: Linux 5.14.0-162.6.1.el9_1.x86_64
    Architecture: x86-64
 Hardware Vendor: VMware, Inc.
  Hardware Model: VMware Virtual Platform

conda list:


(cellpose) [barc@accessv01 ~]$ conda list
# packages in environment at /home/projects/zeeviai/barc/.conda/envs/cellpose:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
bzip2                     1.0.8                h5eee18b_6
ca-certificates           2024.3.11            h06a4308_0
cellpose                  3.0.8                    pypi_0    pypi
cyrus-sasl                2.1.28               h52b45da_1
dbus                      1.13.18              hb2f20db_0
expat                     2.6.2                h6a678d5_0
fastremap                 1.14.1                   pypi_0    pypi
filelock                  3.14.0                   pypi_0    pypi
fontconfig                2.14.1               h4c34cd2_2
freetype                  2.12.1               h4a9f257_0
fsspec                    2024.3.1                 pypi_0    pypi
glib                      2.78.4               h6a678d5_0
glib-tools                2.78.4               h6a678d5_0
gst-plugins-base          1.14.1               h6a678d5_1
gstreamer                 1.14.1               h5eee18b_1
icu                       73.1                 h6a678d5_0
imagecodecs               2023.3.16                pypi_0    pypi
importlib-metadata        7.1.0                    pypi_0    pypi
jinja2                    3.1.4                    pypi_0    pypi
jpeg                      9e                   h5eee18b_1
krb5                      1.20.1               h143b758_1
ld_impl_linux-64          2.38                 h1181459_1
libclang                  14.0.6          default_hc6dbbc7_1
libclang13                14.0.6          default_he11475f_1
libcups                   2.4.2                h2d74bed_1
libedit                   3.1.20230828         h5eee18b_0
libffi                    3.4.4                h6a678d5_1
libgcc-ng                 13.2.0               h77fa898_7    conda-forge
libglib                   2.78.4               hdc74915_0
libgomp                   13.2.0               h77fa898_7    conda-forge
libiconv                  1.16                 h5eee18b_3
libllvm14                 14.0.6               hdb19cb5_3
libpng                    1.6.39               h5eee18b_0
libpq                     12.17                hdbd6064_0
libstdcxx-ng              11.2.0               h1234567_1
libuuid                   1.41.5               h5eee18b_0
libxcb                    1.16                 hd590300_0    conda-forge
libxkbcommon              1.0.1                h5eee18b_1
libxml2                   2.10.4               hfdd30dd_2
llvmlite                  0.41.1                   pypi_0    pypi
lz4-c                     1.9.4                h6a678d5_1
markupsafe                2.1.5                    pypi_0    pypi
mpmath                    1.3.0                    pypi_0    pypi
mysql                     5.7.24               h721c034_2
natsort                   8.4.0                    pypi_0    pypi
ncurses                   6.4                  h6a678d5_0
networkx                  3.1                      pypi_0    pypi
numba                     0.58.1                   pypi_0    pypi
numpy                     1.24.4                   pypi_0    pypi
nvidia-cublas-cu12        12.1.3.1                 pypi_0    pypi
nvidia-cuda-cupti-cu12    12.1.105                 pypi_0    pypi
nvidia-cuda-nvrtc-cu12    12.1.105                 pypi_0    pypi
nvidia-cuda-runtime-cu12  12.1.105                 pypi_0    pypi
nvidia-cudnn-cu12         8.9.2.26                 pypi_0    pypi
nvidia-cufft-cu12         11.0.2.54                pypi_0    pypi
nvidia-curand-cu12        10.3.2.106               pypi_0    pypi
nvidia-cusolver-cu12      11.4.5.107               pypi_0    pypi
nvidia-cusparse-cu12      12.1.0.106               pypi_0    pypi
nvidia-nccl-cu12          2.20.5                   pypi_0    pypi
nvidia-nvjitlink-cu12     12.4.127                 pypi_0    pypi
nvidia-nvtx-cu12          12.1.105                 pypi_0    pypi
opencv-python-headless    4.9.0.80                 pypi_0    pypi
openssl                   3.0.13               h7f8727e_1
packaging                 24.0                     pypi_0    pypi
pcre2                     10.42                hebb0a14_1
pip                       24.0             py38h06a4308_0
ply                       3.11                     py38_0
pthread-stubs             0.3                  h0ce48e5_1
pygments                  2.18.0                   pypi_0    pypi
pyqt                      5.15.10          py38h6a678d5_0
pyqt5-qt5                 5.15.2                   pypi_0    pypi
pyqt5-sip                 12.13.0          py38h5eee18b_0
pyqt6-sip                 13.6.0                   pypi_0    pypi
pyqtgraph                 0.13.3                   pypi_0    pypi
python                    3.8.19               h955ad1f_0
qt-main                   5.15.2              h53bd1ea_10
qtpy                      2.4.1                    pypi_0    pypi
readline                  8.2                  h5eee18b_0
roifile                   2023.5.12                pypi_0    pypi
scipy                     1.10.1                   pypi_0    pypi
setuptools                69.5.1           py38h06a4308_0
sip                       6.7.12           py38h6a678d5_0
sqlite                    3.45.3               h5eee18b_0
superqt                   0.6.5                    pypi_0    pypi
sympy                     1.12                     pypi_0    pypi
tifffile                  2023.7.10                pypi_0    pypi
tk                        8.6.14               h39e8969_0
tomli                     2.0.1            py38h06a4308_0
torch                     2.3.0                    pypi_0    pypi
tqdm                      4.66.4                   pypi_0    pypi
triton                    2.3.0                    pypi_0    pypi
typing-extensions         4.11.0                   pypi_0    pypi
wheel                     0.43.0           py38h06a4308_0
xorg-libxau               1.0.11               hd590300_0    conda-forge
xorg-libxdmcp             1.1.3                h7f98852_0    conda-forge
xz                        5.4.6                h5eee18b_1
zipp                      3.18.1                   pypi_0    pypi
zlib                      1.2.13               h5eee18b_1
zstd                      1.5.5                hc292b87_2