Wednesday, 1 January 2020

Python not finding a library (so, dll) from a PyPi package

I am using PyQt5 library and trying to use pylupdate:

from PyQt5.pylupdate_main import main

This gives me the error:

ImportError: libQt5Xml.so.5: cannot open shared object file: No such file or directory

While the file is located in /usr/local/lib/python3.7/site-packages/PyQt5/Qt/lib/

I could fix by doing:

LD_LIBRARY_PATH=/usr/local/lib/python3.7/site-packages/PyQt5/Qt/lib/:$LD_LIBRARY_PATH python -c "from PyQt5.pylupdate_main import main"

It used to work without adding the path before. How can this be done? Is this something to fix in the wheel?


This can be easily reproduced with Docker:

FROM python:3.7
RUN pip install PyQt5
RUN echo $(ls /usr/local/lib/python3.7/site-packages/PyQt5/Qt/lib/libQt5Xml.so.5)
RUN ldd /usr/local/lib/python3.7/site-packages/PyQt5/Qt/lib/libQt5Xml.so.5
RUN python -c "from PyQt5.pylupdate_main import main"

Output of ldd /usr/local/lib/python3.7/site-packages/PyQt5/Qt/lib/libQt5Xml.so.5 is these:

 ---> Running in 6c4c1fbe5de2
    linux-vdso.so.1 (0x00007ffecb7d5000)
    libQt5Core.so.5 => /usr/local/lib/python3.7/site-packages/PyQt5/Qt/lib/libQt5Core.so.5 (0x00007fbc76abe000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbc76a94000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fbc76910000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fbc7678d000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fbc76773000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbc765b2000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fbc76392000)
    libicui18n.so.56 => /usr/local/lib/python3.7/site-packages/PyQt5/Qt/lib/libicui18n.so.56 (0x00007fbc75ef9000)
    libicuuc.so.56 => /usr/local/lib/python3.7/site-packages/PyQt5/Qt/lib/libicuuc.so.56 (0x00007fbc75b41000)
    libicudata.so.56 => /usr/local/lib/python3.7/site-packages/PyQt5/Qt/lib/libicudata.so.56 (0x00007fbc7415e000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbc74159000)
    libgthread-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007fbc74154000)
    libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbc74033000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fbc774d1000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007fbc73fbf000)


from Python not finding a library (so, dll) from a PyPi package

No comments:

Post a Comment