【发布时间】:2020-12-02 04:21:20
【问题描述】:
我们的项目使用 QT(PySide2、qtpy),并使用 sphinx autodoc 记录在 ReadTheDocs 上。到目前为止,我们已经模拟了大多数依赖项,但在这种特定情况下,模拟 qtpy 非常复杂。我希望通过在.readthedocs.yml 的conda 或python 部分中安装依赖项来简化。
安装似乎工作正常,但我在 RTD 构建的 sphinx-build 步骤中遇到错误:
qt.qpa.xcb: could not connect to display
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.
Fatal Python error: Aborted
回溯指向我们代码中的行:QT_APP = QApplication(sys.argv)。
我已尝试设置 QT_DEBUG_PLUGINS=1,它提供了一些我无法做出的输出:
...
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/docs/checkouts/readthedocs.org/user_builds/invest/conda/395/bin/platforms" ...
loaded library "/home/docs/checkouts/readthedocs.org/user_builds/invest/conda/395/lib/python3.8/site-packages/PySide2/Qt/plugins/platforms/libqeglfs.so"
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-docs'
QFactoryLoader::QFactoryLoader() checking directory path "/home/docs/checkouts/readthedocs.org/user_builds/invest/conda/395/lib/python3.8/site-packages/PySide2/Qt/plugins/egldeviceintegrations" ...
QFactoryLoader::QFactoryLoader() looking at "/home/docs/checkouts/readthedocs.org/user_builds/invest/conda/395/lib/python3.8/site-packages/PySide2/Qt/plugins/egldeviceintegrations/libqeglfs-emu-integration.so"
Found metadata in lib /home/docs/checkouts/readthedocs.org/user_builds/invest/conda/395/lib/python3.8/site-packages/PySide2/Qt/plugins/egldeviceintegrations/libqeglfs-emu-integration.so, metadata=
{
"IID": "org.qt-project.qt.qpa.egl.QEglFSDeviceIntegrationFactoryInterface.5.5",
"MetaData": {
"Keys": [
"eglfs_emu"
]
},
"archreq": 0,
"className": "QEglFSEmulatorIntegrationPlugin",
"debug": false,
"version": 331520
}
...
我尝试通过设置QT_QPA_PLATFORM=eglfs 来更改平台插件,这会产生类似的错误:Could not initialize egl display。谷歌搜索错误大多与 Raspberry Pi 相关。
这是因为运行构建的虚拟机实际上没有显示器吗?有没有办法解决这个问题?
【问题讨论】:
标签: python python-sphinx pyside2 read-the-docs xcb