Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error: qt.qpa.xcb: could not connect to display



  • Hello everyone,

    first off thank you very much for your time. It's my first post to the forum and I hope this is the right place for it. I refrained from posting it in the python directory, as I believe this is related to installation problems. Ülease let me know if I am wrong.

    I am trying to use pyqtgraph under a (ana)conda environment in Ubuntu 18.04LTS on a remote server and have come across the following problem, when I import "import pyqtgraph as pg" and try to launch "pg.mkQApp()"

    QFactoryLoader::QFactoryLoader() checking directory path "/home/mike/anaconda3/envs/CondaEnv/bin/platforms" ...
    loaded library "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqxcb.so"
    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, minimal, minimalegl, offscreen, vnc, webgl, xcb.
    

    As I am not a root user on the server, I then duplicated the conda environment on my local Ubuntu 20.04 LTS machine and tested everything there, where everything works just fine.

    As libxcb is installed and everything is found, I am not sure how to properly debug this. Can anyone help?



  • @ubuntu712
    Set environment variable export QT_DEBUG_PLUGINS=1 and then run your Python program. Look at the end of the diagnostic output.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Do you have any other graphical application that works from that remote server ?

    How do you connect to it ?



  • @SGaist: Thank you! I honestly don't know. Perhaps you could provide an example of some generic application that would be normally installed? I am guessing that the admin tries to keep it as minimalist as possible, but I am not sure.
    I normally connect over SSH; I can utilize jupyter lab when I redirect the port to my localhost;
    but the admin said that an X11 forwarding should work as well.

    @JonB: Thank you, I just tried. Can you help with the interpretation?

    QFactoryLoader::QFactoryLoader() checking directory path "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqeglfs.so"
    Found metadata in lib /home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqeglfs.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "eglfs"
            ]
        },
        "archreq": 0,
        "className": "QEglFSIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("eglfs")
    QFactoryLoader::QFactoryLoader() looking at "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqminimal.so"
    Found metadata in lib /home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqminimal.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "archreq": 0,
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqminimalegl.so"
    Found metadata in lib /home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqminimalegl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimalegl"
            ]
        },
        "archreq": 0,
        "className": "QMinimalEglIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("minimalegl")
    QFactoryLoader::QFactoryLoader() looking at "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqoffscreen.so"
    Found metadata in lib /home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqoffscreen.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "archreq": 0,
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqvnc.so"
    Found metadata in lib /home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqvnc.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "vnc"
            ]
        },
        "archreq": 0,
        "className": "QVncIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("vnc")
    QFactoryLoader::QFactoryLoader() looking at "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqwebgl.so"
    Found metadata in lib /home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqwebgl.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "webgl"
            ]
        },
        "archreq": 0,
        "className": "QWebGLIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("webgl")
    QFactoryLoader::QFactoryLoader() looking at "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqxcb.so"
    Found metadata in lib /home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqxcb.so, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "xcb"
            ]
        },
        "archreq": 0,
        "className": "QXcbIntegrationPlugin",
        "debug": false,
        "version": 330752
    }
    
    
    Got keys from plugin meta data ("xcb")
    QFactoryLoader::QFactoryLoader() checking directory path "/home/mike/anaconda3/envs/CondaEnv/bin/platforms" ...
    loaded library "/home/mike/anaconda3/envs/CondaEnv/plugins/platforms/libqxcb.so"
    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, minimal, minimalegl, offscreen, vnc, webgl, xcb.
    
    Aborted (core dumped)
    
    


  • @ubuntu712 said in Error: qt.qpa.xcb: could not connect to display:

    qt.qpa.xcb: could not connect to display

    I know that this is the problem! I did not notice this was in your original post. People like @SGaist know more then I do and I'm sure they will help. It's something about your remote server, X11 display stuff :)


  • Lifetime Qt Champion

    How are you currently connecting to your remote machine ?

    Jupiter lab does sadly does not help as it is a server setup that you access through your web browser.

    As for testing, your admin is likely more knowledgeable on what is installed on that remote machine.



  • I am currently connecting via ssh on a terminal. I've tried a bunch, I currently do not know of any graphical user interface that is installed.

    What would be next step I could test from my side? The admin is quite busy I think; I can submit packages for installation, but it would be good if I could do most of the testing. Furthermore, I would like to learn what I am doing wrong, in case I have to setup the toolchain on another server any time soon :)


  • Lifetime Qt Champion

    What exact line do you use with ssh to connect to that machine ?



  • @SGaist in a ubuntu terminal I use: ssh user@ipadress (after connecting over a vpn)


  • Lifetime Qt Champion

    Unless you have an ssh config that sets some parameters when you connect to that remote, you are at least missing the -X parameter. X11 forwarding is not on by default.



  • Oh thank you so much, that did the trick for me. Learned a lot today! Thank you again for your patience, in the end this turned out to be completely unrelated to qt!



  • @ubuntu712 said in Error: qt.qpa.xcb: could not connect to display:

    that did the trick for me

    great! so please don't forget to mark your post as solved then.


Log in to reply