[英]After installing pyqt5==5.14.0, error shows as Could not load the Qt platform plugin "xcb" in "" even though it was found
I have accidentally installed pyqt5==5.14.0 for testing for pandasGUI as seen in a tutorial in my ubuntu system.我不小心安装了pyqt5==5.14.0来测试 pandasGUI,如我的 ubuntu 系统教程中所示。 However, now i am unable to plot any graphs using matplotlib as it shows error as但是,现在我无法使用 matplotlib 绘制任何图形,因为它显示的错误为
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 have seen some solutions suggest for looking into /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so file.我已经看到一些解决方案建议查看/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so文件。 But such a file or qt5 directory is not seen in this path in my system.但是这样的文件或者qt5目录在我系统的这个路径下是看不到的。
I just need to get the proper matplotlib functioning back.我只需要让正确的 matplotlib 恢复运行。
You would need to get some debugging information first to point to the right direction.您需要先获得一些调试信息才能指向正确的方向。 For this you run your command with qt debugging set:为此,您使用 qt 调试集运行您的命令:
QT_DEBUG_PLUGINS=1 picard
This would (try) to run my picard binary with debugging output in the console/terminal which will give you output similar to:这将(尝试)在控制台/终端中使用调试输出运行我的 picard 二进制文件,这将为您提供类似于以下内容的输出:
loaded library "crypto"
loaded library "ssl"
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib64/kde4/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/kde4/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() checking directory path "/home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqeglfs.so"
Found metadata in lib /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqeglfs.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"eglfs"
]
},
"archreq": 0,
"className": "QEglFSIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("eglfs")
QFactoryLoader::QFactoryLoader() looking at "/home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqlinuxfb.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"linuxfb"
]
},
"archreq": 0,
"className": "QLinuxFbIntegrationPlugin",
"debug": false,
"version": 331520
}
Got keys from plugin meta data ("linuxfb")
QFactoryLoader::QFactoryLoader() looking at "/home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqminimal.so"
Found metadata in lib /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqminimal.so, metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
"MetaData": {
"Keys": [
"minimal"
]
},
"archreq": 0,
"className": "QMinimalIntegrationPlugin",
"debug": false,
"version": 331520
}
...
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/platforms" ...
Cannot load library /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so" : "Cannot load library /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: 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.
This is the critical part indicating a system library file is missing:这是表明缺少系统库文件的关键部分:
Cannot load library /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)
QLibraryPrivate::loadPlugin failed on "/home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so" : "Cannot load library /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so: (libxkbcommon-x11.so.0: cannot open shared object file: No such file or directory)"
As we can see, the library being loaded python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so
is itself trying to load a missing linked library libxkbcommon-x11.so.0
as indicated by the "No such file..." error.正如我们所看到的,正在加载的库python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so
本身正在尝试加载缺少的链接库libxkbcommon-x11.so.0
如“No这样的文件...”错误。
You can verify this by using ldd
to list the libraries links, for example:您可以通过使用ldd
列出库链接来验证这一点,例如:
ldd /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so
linux-vdso.so.1 => (0x00007ffc57340000)
libQt5XcbQpa.so.5 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5XcbQpa.so.5 (0x00007f2ef6b4e000)
libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007f2ef690c000)
libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007f2ef664d000)
libz.so.1 => /lib64/libz.so.1 (0x00007f2ef6437000)
libQt5Gui.so.5 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5Gui.so.5 (0x00007f2ef5b06000)
libQt5DBus.so.5 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5DBus.so.5 (0x00007f2ef587a000)
libQt5Core.so.5 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5Core.so.5 (0x00007f2ef5084000)
libGL.so.1 => /lib64/libGL.so.1 (0x00007f2ef4df8000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2ef4bdc000)
libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007f2ef49da000)
libxcb-icccm.so.4 => /lib64/libxcb-icccm.so.4 (0x00007f2ef47d5000)
libxcb-image.so.0 => /lib64/libxcb-image.so.0 (0x00007f2ef45d0000)
libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007f2ef43cc000)
libxcb-util.so.1 => /lib64/libxcb-util.so.1 (0x00007f2ef41c6000)
libxcb-keysyms.so.1 => /lib64/libxcb-keysyms.so.1 (0x00007f2ef3fc3000)
libxcb-randr.so.0 => /lib64/libxcb-randr.so.0 (0x00007f2ef3db3000)
libxcb-render-util.so.0 => /lib64/libxcb-render-util.so.0 (0x00007f2ef3baf000)
libxcb-render.so.0 => /lib64/libxcb-render.so.0 (0x00007f2ef39a1000)
libxcb-shape.so.0 => /lib64/libxcb-shape.so.0 (0x00007f2ef379d000)
libxcb-sync.so.1 => /lib64/libxcb-sync.so.1 (0x00007f2ef3596000)
libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007f2ef338e000)
libxcb-xinerama.so.0 => /lib64/libxcb-xinerama.so.0 (0x00007f2ef318b000)
libxcb-xkb.so.1 => /lib64/libxcb-xkb.so.1 (0x00007f2ef2f6f000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f2ef2d47000)
libXext.so.6 => /lib64/libXext.so.6 (0x00007f2ef2b35000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007f2ef27f7000)
libxkbcommon-x11.so.0 => not found
libxkbcommon.so.0 => /lib64/libxkbcommon.so.0 (0x00007f2ef25b7000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f2ef23b3000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f2ef20ab000)
libm.so.6 => /lib64/libm.so.6 (0x00007f2ef1da9000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f2ef1b93000)
libc.so.6 => /lib64/libc.so.6 (0x00007f2ef17c5000)
libxkbcommon-x11.so.0 => not found
libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f2ef15c3000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f2ef12ad000)
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f2ef1083000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f2ef0e7e000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f2ef0c6e000)
libpng15.so.15 => /lib64/libpng15.so.15 (0x00007f2ef0a43000)
libdbus-1.so.3 => /lib64/libdbus-1.so.3 (0x00007f2ef07f3000)
libicui18n.so.56 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libicui18n.so.56 (0x00007f2ef035a000)
libicuuc.so.56 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libicuuc.so.56 (0x00007f2eeffa2000)
libicudata.so.56 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libicudata.so.56 (0x00007f2eee5bf000)
/lib64/ld-linux-x86-64.so.2 (0x00007f2ef70ab000)
libGLX.so.0 => /lib64/libGLX.so.0 (0x00007f2eee38d000)
libGLdispatch.so.0 => /lib64/libGLdispatch.so.0 (0x00007f2eee0d7000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f2eeded3000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f2eedc71000)
libsystemd.so.0 => /lib64/libsystemd.so.0 (0x00007f2eeda40000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f2eed83b000)
librt.so.1 => /lib64/librt.so.1 (0x00007f2eed633000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f2eed40c000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f2eed1e6000)
liblz4.so.1 => /lib64/liblz4.so.1 (0x00007f2eecfd7000)
libgcrypt.so.11 => /lib64/libgcrypt.so.11 (0x00007f2eecd56000)
libgpg-error.so.0 => /lib64/libgpg-error.so.0 (0x00007f2eecb51000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f2eec937000)
libdw.so.1 => /lib64/libdw.so.1 (0x00007f2eec6e6000)
libattr.so.1 => /lib64/libattr.so.1 (0x00007f2eec4e1000)
libelf.so.1 => /lib64/libelf.so.1 (0x00007f2eec2c9000)
or more concisely ldd /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so | grep -i "not found"
或更简洁的ldd /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so | grep -i "not found"
ldd /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so | grep -i "not found"
you can then see that the error you got in the debugging output is in fact caused by a missing library dependency -- not having anything directly to do with QT. ldd /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so | grep -i "not found"
然后你可以看到你在调试输出中得到的错误实际上是由缺少库依赖引起的——与 QT 没有任何直接关系。
In this example case, I was on CentOS, so I could use yum
to search for what provides the missing library yum provides libxkbcommon-x11
or yum search libxkb
to see any packages that might match.在这个例子中,我在 CentOS 上,所以我可以使用yum
搜索提供缺失库的内容yum provides libxkbcommon-x11
或yum search libxkb
以查看任何可能匹配的包。
Once the missing package was installed you could see using ldd that all library dependencies are satisfied:安装缺少的包后,您可以使用 ldd 看到所有库依赖项都得到满足:
ldd /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/libqxcb.so
linux-vdso.so.1 => (0x00007ffd6ea36000)
libQt5XcbQpa.so.5 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5XcbQpa.so.5 (0x00007f3c32187000)
libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x00007f3c31f45000)
libfreetype.so.6 => /lib64/libfreetype.so.6 (0x00007f3c31c86000)
libz.so.1 => /lib64/libz.so.1 (0x00007f3c31a70000)
libQt5Gui.so.5 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5Gui.so.5 (0x00007f3c3113f000)
libQt5DBus.so.5 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5DBus.so.5 (0x00007f3c30eb3000)
libQt5Core.so.5 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libQt5Core.so.5 (0x00007f3c306bd000)
libGL.so.1 => /lib64/libGL.so.1 (0x00007f3c30431000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f3c30215000)
libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x00007f3c30013000)
libxcb-icccm.so.4 => /lib64/libxcb-icccm.so.4 (0x00007f3c2fe0e000)
libxcb-image.so.0 => /lib64/libxcb-image.so.0 (0x00007f3c2fc09000)
libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x00007f3c2fa05000)
libxcb-util.so.1 => /lib64/libxcb-util.so.1 (0x00007f3c2f7ff000)
libxcb-keysyms.so.1 => /lib64/libxcb-keysyms.so.1 (0x00007f3c2f5fc000)
libxcb-randr.so.0 => /lib64/libxcb-randr.so.0 (0x00007f3c2f3ec000)
libxcb-render-util.so.0 => /lib64/libxcb-render-util.so.0 (0x00007f3c2f1e8000)
libxcb-render.so.0 => /lib64/libxcb-render.so.0 (0x00007f3c2efda000)
libxcb-shape.so.0 => /lib64/libxcb-shape.so.0 (0x00007f3c2edd6000)
libxcb-sync.so.1 => /lib64/libxcb-sync.so.1 (0x00007f3c2ebcf000)
libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x00007f3c2e9c7000)
libxcb-xinerama.so.0 => /lib64/libxcb-xinerama.so.0 (0x00007f3c2e7c4000)
libxcb-xkb.so.1 => /lib64/libxcb-xkb.so.1 (0x00007f3c2e5a8000)
libxcb.so.1 => /lib64/libxcb.so.1 (0x00007f3c2e380000)
libXext.so.6 => /lib64/libXext.so.6 (0x00007f3c2e16e000)
libX11.so.6 => /lib64/libX11.so.6 (0x00007f3c2de30000)
libxkbcommon-x11.so.0 => /lib64/libxkbcommon-x11.so.0 (0x00007f3c2dc28000)
libxkbcommon.so.0 => /lib64/libxkbcommon.so.0 (0x00007f3c2d9e8000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f3c2d7e4000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f3c2d4dc000)
libm.so.6 => /lib64/libm.so.6 (0x00007f3c2d1da000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f3c2cfc4000)
libc.so.6 => /lib64/libc.so.6 (0x00007f3c2cbf6000)
libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x00007f3c2c9f4000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x00007f3c2c6de000)
libexpat.so.1 => /lib64/libexpat.so.1 (0x00007f3c2c4b4000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00007f3c2c2af000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f3c2c09f000)
libpng15.so.15 => /lib64/libpng15.so.15 (0x00007f3c2be74000)
libdbus-1.so.3 => /lib64/libdbus-1.so.3 (0x00007f3c2bc24000)
libicui18n.so.56 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libicui18n.so.56 (0x00007f3c2b78b000)
libicuuc.so.56 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libicuuc.so.56 (0x00007f3c2b3d3000)
libicudata.so.56 => /home/nas/.local/lib/python3.6/site-packages/PyQt5/Qt5/plugins/platforms/../../lib/libicudata.so.56 (0x00007f3c299f0000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3c326e4000)
libGLX.so.0 => /lib64/libGLX.so.0 (0x00007f3c297be000)
libGLdispatch.so.0 => /lib64/libGLdispatch.so.0 (0x00007f3c29508000)
libXau.so.6 => /lib64/libXau.so.6 (0x00007f3c29304000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f3c290a2000)
libsystemd.so.0 => /lib64/libsystemd.so.0 (0x00007f3c28e71000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f3c28c6c000)
librt.so.1 => /lib64/librt.so.1 (0x00007f3c28a64000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f3c2883d000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f3c28617000)
liblz4.so.1 => /lib64/liblz4.so.1 (0x00007f3c28408000)
libgcrypt.so.11 => /lib64/libgcrypt.so.11 (0x00007f3c28187000)
libgpg-error.so.0 => /lib64/libgpg-error.so.0 (0x00007f3c27f82000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f3c27d68000)
libdw.so.1 => /lib64/libdw.so.1 (0x00007f3c27b17000)
libattr.so.1 => /lib64/libattr.so.1 (0x00007f3c27912000)
libelf.so.1 => /lib64/libelf.so.1 (0x00007f3c276fa000)
This is a very specific example in trying to use a freshly built from source MusicBrainz Picard over ssh with X11 Forwarding which considering the package relies on QT AND python which is all being run remotely and the interface forwarded to my local desktop provides many interesting ways for the application to break.这是一个非常具体的例子,试图通过 ssh 使用新构建的 MusicBrainz Picard 和 X11 转发,考虑到包依赖于 QT 和 python,它们都是远程运行的,并且转发到我的本地桌面的接口提供了许多有趣的方法要破解的应用程序。
So the operating theory and troubleshooting strategy is that you can use the QT debugging facility to narrow down where the problem lies and in all likelihood it's a missing library (or several) that your system's package manager can provide or in some cases pip for python (or other language specific package managers).因此,操作理论和故障排除策略是,您可以使用 QT 调试工具来缩小问题所在的范围,并且很可能它是系统包管理器可以提供的缺少的库(或多个),或者在某些情况下是 Python 的 pip(或其他语言特定的包管理器)。
I hope this helps someone else with a similar problem - as I was initially thinking it was a QT5 problem, then a Python problem, then a bug with the software I was trying to run, when it was a missing system library I wouldn't have suspected.我希望这可以帮助遇到类似问题的其他人 - 因为我最初认为这是 QT5 问题,然后是 Python 问题,然后是我尝试运行的软件的错误,当它丢失系统库时,我不会有怀疑。
EDIT: I just saw this post as a suggestion and it's pretty much the same advice I have here, but surrounded with a lot more context, so I'll link it here https://stackoverflow.com/a/39725335/1112676编辑:我只是将这篇文章视为一个建议,它与我在这里的建议几乎相同,但包含更多上下文,因此我将其链接到这里https://stackoverflow.com/a/39725335/1112676
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.