Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load the QT platform "xcb" even though it was found. #19361

Closed
2 of 4 tasks
baskpann opened this issue Jan 20, 2021 · 4 comments
Closed
2 of 4 tasks

Could not load the QT platform "xcb" even though it was found. #19361

baskpann opened this issue Jan 20, 2021 · 4 comments
Labels
category: 3rdparty question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org

Comments

@baskpann
Copy link

baskpann commented Jan 20, 2021

System information (version)
  • OpenCV => 4.5.1.48
  • Operating System / Platform => Ubuntu 20.10
  • Compiler => Visual Studio 2020
Detailed description

I'm trying to run a face recognition algorithm in python3.8.5(in anaconda4.9 under a env base).
Once cv2.imshow() is encountered, I'm getting the following error.

qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/bas/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins" 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: xcb.

Aborted (core dumped)

Also I tried executing the code with QT_DEBUG_PLUGINS=1 python3 my_script.py still provides the same error along with debug lines.

QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xz"
"Failed to extract plugin meta data from '/home/bas/anaconda3/bin/xz'" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xzcat"
"Failed to extract plugin meta data from '/home/bas/anaconda3/bin/xz'" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xzcmp"
QElfParser: '/home/bas/anaconda3/bin/xzdiff' is not an ELF object
"'/home/bas/anaconda3/bin/xzdiff' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xzdec"
"Failed to extract plugin meta data from '/home/bas/anaconda3/bin/xzdec'" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xzdiff"
QElfParser: '/home/bas/anaconda3/bin/xzdiff' is not an ELF object
"'/home/bas/anaconda3/bin/xzdiff' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xzegrep"
QElfParser: '/home/bas/anaconda3/bin/xzgrep' is not an ELF object
"'/home/bas/anaconda3/bin/xzgrep' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xzfgrep"
QElfParser: '/home/bas/anaconda3/bin/xzgrep' is not an ELF object
"'/home/bas/anaconda3/bin/xzgrep' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xzgrep"
QElfParser: '/home/bas/anaconda3/bin/xzgrep' is not an ELF object
"'/home/bas/anaconda3/bin/xzgrep' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xzless"
QElfParser: '/home/bas/anaconda3/bin/xzless' is not an ELF object
"'/home/bas/anaconda3/bin/xzless' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/xzmore"
QElfParser: '/home/bas/anaconda3/bin/xzmore' is not an ELF object
"'/home/bas/anaconda3/bin/xzmore' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/zstd"
"Failed to extract plugin meta data from '/home/bas/anaconda3/bin/zstd'" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/zstdcat"
"Failed to extract plugin meta data from '/home/bas/anaconda3/bin/zstd'" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/zstdgrep"
QElfParser: '/home/bas/anaconda3/bin/zstdgrep' is not an ELF object
"'/home/bas/anaconda3/bin/zstdgrep' is not an ELF object" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/zstdless"
QElfParser: '/home/bas/anaconda3/bin/zstdless' is not an ELF object (file too small)
"'/home/bas/anaconda3/bin/zstdless' is not an ELF object (file too small)" 
         not a plugin
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/bin/zstdmt"
"Failed to extract plugin meta data from '/home/bas/anaconda3/bin/zstd'" 
         not a plugin
QFactoryLoader::QFactoryLoader() checking directory path "/home/bas/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins/platforms/libqxcb.so"
Found metadata in lib /home/bas/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "archreq": 0,
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 331520
}


Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/bas/anaconda3/bin/platforms" ...
loaded library "/home/bas/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins/platforms/libqxcb.so"
qt.qpa.xcb: could not connect to display 
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/bas/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins" 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: xcb.

Aborted (core dumped)
Steps to reproduce
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc
@alalek
Copy link
Member

alalek commented Jan 21, 2021

Ensure what you don't have mess with Qt binaries from different locations in the process: #17827 (comment)


qt.qpa.xcb: could not connect to display

This message usually means wrong/missing configuration (usually missing DISPLAY due to terminal connection).

  • Check other simple GUI applications (without OpenCV).
  • Check other Qt based GUI applications (without OpenCV).

@baskpann
Copy link
Author

baskpann commented Jan 21, 2021

Could you please brief about what should I do now? Should I reinstall opencv-python and opencv-contrib-python?

@alalek
Copy link
Member

alalek commented Jan 21, 2021

opencv-python and opencv-contrib-python

These packages are unofficial.
There are several compatibility issues, so you should check package's issues here first: https://github.com/skvark/opencv-python/issues


If you want report issue about OpenCV source code, then you need to build OpenCV from sources and confirm the problem.


Usage questions should go to Users OpenCV Q/A forum: https://forum.opencv.org/
This tracker is for issues and bugs that needs fix in OpenCV.

@shuang1204
Copy link

我在做目标检测的时候也遇到了相同的问题,请问您解决了嘛@Baskaran Panneerselvam baskpann

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: 3rdparty question (invalid tracker) ask questions and other "no action" items here: https://forum.opencv.org
Projects
None yet
Development

No branches or pull requests

3 participants