Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. qt.qpa.screen: QXcbConnection: Could not connect to display Could not connect to any X display.
Forum Updated to NodeBB v4.3 + New Features

qt.qpa.screen: QXcbConnection: Could not connect to display Could not connect to any X display.

Scheduled Pinned Locked Moved Unsolved Qt for Python
27 Posts 4 Posters 41.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jsulmJ jsulm

    @lcleve Just to be sure: you do not start your app as root/sudo but normal user?

    L Offline
    L Offline
    lcleve
    wrote on last edited by
    #8

    @jsulm

    Thank you for your just-to-be-sure question, as I am a complete newcomer to Linux. Initially, I opened the program as a normal user. After your message, I looked up how to open as root. Using the following, I opened it up as root:
    sudo code --user-data-dir="~/.vscode-root". The program then opened up, but the gui was distorted, being too large for a 1920x1080 screen even though the size was set to 1920x1080 pixels. The text was also enlarged and out of expected boundaries. I also opened up the .ui file using the newly installed Qt5Designer on my Ubuntu system. It looked fine - identical to what was seen on Mojave OS. However, no change when the program was opened again from root.
    After opening as root, I got the following terminal output:
    root@jonathan-HP-Compaq-Elite-8300-USDT:/home/jonathan# source activate anno_env
    bash: activate: No such file or directory
    root@jonathan-HP-Compaq-Elite-8300-USDT:/home/jonathan# /usr/bin/env /home/jonathan/anaconda3/envs/anno_env/bin/python3.7 /root/.vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/python/debugpy/launcher 33145 -- /home/jonathan/fullgui9JHC.gyp
    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'

    With much appreciation for your help.

    lcleve

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #9

      Did you try to start your application directly from the command line outside of VSCode ?

      As for root it was just to make sure you did not do that as there are additional security restriction to avoid starting GUI application by default.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        lcleve
        wrote on last edited by
        #10

        Thanks for the clarification re root.

        After your message, I opened the program from the command line and got the same distorted gui.

        A popup message dialog seems to work. A file selection dialog also opens. Clicking and dragging the title bar doesn't work.

        Thanks for your help.

        lcleve

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #11

          What if you just create a minimal script showing a single QWidget ?

          What do you get ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          L 1 Reply Last reply
          0
          • SGaistS SGaist

            What if you just create a minimal script showing a single QWidget ?

            What do you get ?

            L Offline
            L Offline
            lcleve
            wrote on last edited by
            #12

            @SGaist
            I used the same imports and the same conda env. Below is the code and terminal output:

            from PyQt5 import uic, QtGui, Qt, QtCore
            from PyQt5.QtGui import QKeySequence
            from PyQt5 import QtWidgets
            from PyQt5.QtCore import pyqtSlot
            from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit, QFileDialog, QMessageBox, QLabel
            import pandas as pd
            import time
            import numpy as np
            import os
            import os.path
            import getpass

            app = QApplication([])

            label = QLabel(' Hello World!')

            label.show()

            app.exe()

            Terminal Output:

            (base) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ source /home/jonathan/anaconda3/bin/activate
            (base) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ conda activate anno_env
            /usr/bin/env /home/jonathan/anaconda3/envs/anno_env/bin/python /home/jonathan/.vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/python/debugpy/launcher 43883 -- /home/jonathan/PyQtTest.py
            (anno_env) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ /usr/bin/env /home/jonathan/anaconda3/envs/anno_env/bin/python /home/jonathan/.vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/python/debugpy/launcher 43883 -- /home/jonathan/PyQtTest.py
            qt.qpa.screen: QXcbConnection: Could not connect to display
            Could not connect to any X display.
            (anno_env) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #13

              What is that debugpy ?

              You seem to not have any environment variables set which is a bit surprising.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              L 1 Reply Last reply
              0
              • SGaistS SGaist

                What is that debugpy ?

                You seem to not have any environment variables set which is a bit surprising.

                L Offline
                L Offline
                lcleve
                wrote on last edited by
                #14

                @SGaist
                I don't know what debugpy refers to. However, when I ran the program, I used the run-without-debug option in vscode.

                I saw on the Qt website that Ubuntu 18.04 was supported, so I tested our program with this version and got the same error message: Could not connect to any X display. I also checked and found that x11 was being used.

                Regarding environment variables, I do not recall having to set any when using MacOS Mojave where the program ran fine and I have seen no dialogs for this while setting up the Ubuntu 20.10 system. Any advice on how to explore this would be appreciated, since I do not have prior experience with this.

                I have also checked permissions for the various files using the GUI options.

                Once again, many thanks.

                lcleve

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #15

                  X11 is Linux only there's nothing here to compare with macOS.

                  How did you test that on 18.04 ?

                  One thing that I find really strange is that env seem to return empty which is something that is highly unexpected.

                  How are you starting your terminal ?
                  Which one do you use ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  L 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    X11 is Linux only there's nothing here to compare with macOS.

                    How did you test that on 18.04 ?

                    One thing that I find really strange is that env seem to return empty which is something that is highly unexpected.

                    How are you starting your terminal ?
                    Which one do you use ?

                    L Offline
                    L Offline
                    lcleve
                    wrote on last edited by
                    #16

                    @SGaist

                    I tested for x11 using: echo $XDG_SESSION_TYPE at the $prompt of the terminal. The terminal I used is the default terminal that installed with the operating systems (18.04 and 20.10), presumably gnome-terminal? Should I switch to another?

                    What is it that you see that indicates that "env seems to return empty"?

                    Could it be a matter of permissions, given that that a gui (albeit distorted ) did appear on the screen when I opened from root?

                    Thanks.

                    lcleve

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #17

                      I thought you called the env command and did not saw anything printed.

                      So it was not the case, can you call it and show what you get ?

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      L 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        I thought you called the env command and did not saw anything printed.

                        So it was not the case, can you call it and show what you get ?

                        L Offline
                        L Offline
                        lcleve
                        wrote on last edited by
                        #18

                        @SGaist
                        here is the result for 18.04. If this is not informative, I can send the result for 20.10, but it will take me a few minuttes to change hard drives.

                        (base) william@william-HP-Compaq-Elite-8300-USDT:~$ env
                        CLUTTER_IM_MODULE=xim
                        CONDA_SHLVL=1
                        LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.Z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:.xspf=00;36:
                        CONDA_EXE=/home/william/anaconda3/bin/conda
                        LESSCLOSE=/usr/bin/lesspipe %s %s
                        XDG_MENU_PREFIX=gnome-
                        LANG=en_US.UTF-8
                        DISPLAY=:0
                        GNOME_SHELL_SESSION_MODE=ubuntu
                        COLORTERM=truecolor
                        USERNAME=william
                        CONDA_PREFIX=/home/william/anaconda3
                        XDG_VTNR=2
                        SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
                        MANDATORY_PATH=/usr/share/gconf/ubuntu.mandatory.path
                        S_COLORS=auto
                        _CE_M=
                        XDG_SESSION_ID=2
                        USER=william
                        DESKTOP_SESSION=ubuntu
                        QT4_IM_MODULE=xim
                        TEXTDOMAINDIR=/usr/share/locale/
                        GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/4415aacb_f29d_41fc_969b_1ecfb25dfbd2
                        DEFAULTS_PATH=/usr/share/gconf/ubuntu.default.path
                        PWD=/home/william
                        HOME=/home/william
                        CONDA_PYTHON_EXE=/home/william/anaconda3/bin/python
                        TEXTDOMAIN=im-config
                        SSH_AGENT_PID=2421
                        QT_ACCESSIBILITY=1
                        XDG_SESSION_TYPE=x11
                        XDG_DATA_DIRS=/usr/share/ubuntu:/home/william/.local/share/flatpak/exports/share/:/var/lib/flatpak/exports/share/:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
                        _CE_CONDA=
                        XDG_SESSION_DESKTOP=ubuntu
                        GJS_DEBUG_OUTPUT=stderr
                        CONDA_PROMPT_MODIFIER=(base)
                        GTK_MODULES=gail:atk-bridge
                        WINDOWPATH=2
                        TERM=xterm-256color
                        SHELL=/bin/bash
                        VTE_VERSION=5202
                        QT_IM_MODULE=ibus
                        XMODIFIERS=@im=ibus
                        IM_CONFIG_PHASE=2
                        XDG_CURRENT_DESKTOP=ubuntu:GNOME
                        GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
                        GNOME_TERMINAL_SERVICE=:1.84
                        XDG_SEAT=seat0
                        SHLVL=1
                        GDMSESSION=ubuntu
                        GNOME_DESKTOP_SESSION_ID=this-is-deprecated
                        LOGNAME=william
                        DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
                        XDG_RUNTIME_DIR=/run/user/1000
                        XAUTHORITY=/run/user/1000/gdm/Xauthority
                        XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
                        PATH=/home/william/anaconda3/bin:/home/william/anaconda3/condabin:/home/william/.local/bin:/home/william/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
                        CONDA_DEFAULT_ENV=base
                        GJS_DEBUG_TOPICS=JS ERROR;JS LOG
                        SESSION_MANAGER=local/william-HP-Compaq-Elite-8300-USDT:@/tmp/.ICE-unix/2324,unix/william-HP-Compaq-Elite-8300-USDT:/tmp/.ICE-unix/2324
                        LESSOPEN=| /usr/bin/lesspipe %s
                        GTK_IM_MODULE=ibus
                        _=/usr/bin/env

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #19

                          Everything looks Ok...

                          Next test: can you install and test your code with your distribution provided PyQt5 ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          L 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Everything looks Ok...

                            Next test: can you install and test your code with your distribution provided PyQt5 ?

                            L Offline
                            L Offline
                            lcleve
                            wrote on last edited by
                            #20

                            @SGaist
                            The env results I sent before were for ubuntu 18.04. In retrospect, this may have complicated things unnecessarily, since our goal is is to work on ubuntu 20.10. So below is the env output for 20.10. Note that the username for 20.10 is jonathan. For the older version, it is william.

                            (base) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ env
                            SHELL=/bin/bash
                            SESSION_MANAGER=local/jonathan-HP-Compaq-Elite-8300-USDT:@/tmp/.ICE-unix/1707,unix/jonathan-HP-Compaq-Elite-8300-USDT:/tmp/.ICE-unix/1707
                            QT_ACCESSIBILITY=1
                            COLORTERM=truecolor
                            XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
                            XDG_MENU_PREFIX=gnome-
                            GNOME_DESKTOP_SESSION_ID=this-is-deprecated
                            CONDA_EXE=/home/jonathan/anaconda3/bin/conda
                            _CE_M=
                            GNOME_SHELL_SESSION_MODE=ubuntu
                            SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
                            XMODIFIERS=@im=ibus
                            DESKTOP_SESSION=ubuntu
                            SSH_AGENT_PID=1663
                            GTK_MODULES=gail:atk-bridge
                            PWD=/home/jonathan
                            LOGNAME=jonathan
                            XDG_SESSION_DESKTOP=ubuntu
                            XDG_SESSION_TYPE=x11
                            CONDA_PREFIX=/home/jonathan/anaconda3
                            GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
                            XAUTHORITY=/run/user/1000/gdm/Xauthority
                            GJS_DEBUG_TOPICS=JS ERROR;JS LOG
                            WINDOWPATH=2
                            HOME=/home/jonathan
                            USERNAME=jonathan
                            IM_CONFIG_PHASE=1
                            LANG=en_US.UTF-8
                            LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.webp=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:.xspf=00;36:
                            XDG_CURRENT_DESKTOP=ubuntu:GNOME
                            VTE_VERSION=6200
                            CONDA_PROMPT_MODIFIER=(base)
                            GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/f4b8c0e5_b44e_4a61_8b22_3f26ba220048
                            GJS_DEBUG_OUTPUT=stderr
                            LESSCLOSE=/usr/bin/lesspipe %s %s
                            XDG_SESSION_CLASS=user
                            TERM=xterm-256color
                            _CE_CONDA=
                            LESSOPEN=| /usr/bin/lesspipe %s
                            USER=jonathan
                            GNOME_TERMINAL_SERVICE=:1.81
                            CONDA_SHLVL=1
                            DISPLAY=:0
                            SHLVL=1
                            QT_IM_MODULE=ibus
                            CONDA_PYTHON_EXE=/home/jonathan/anaconda3/bin/python
                            XDG_RUNTIME_DIR=/run/user/1000
                            CONDA_DEFAULT_ENV=base
                            XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
                            PATH=/home/jonathan/anaconda3/bin:/home/jonathan/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
                            GDMSESSION=ubuntu
                            DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
                            _=/usr/bin/env

                            I am not entirely clear on what you mean for the next test. The program was previously transferred from Mojave to 20.10 via flash drive and run from vscode without debugging. After testing the code on Mojave to double check that it was working, I ran the code on 20.10 and got the following:

                            source /home/jonathan/anaconda3/bin/activate
                            (base) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ source /home/jonathan/anaconda3/bin/activate
                            conda activate anno_env
                            (base) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ conda activate anno_env
                            (anno_env) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ /usr/bin/env /home/jonathan/anaconda3/envs/anno_env/bin/python /home/jonathan/.vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/python/debugpy/launcher 40389 -- /home/jonathan/fullgui9JHC.gyp
                            qt.qpa.screen: QXcbConnection: Could not connect to display
                            Could not connect to any X display.
                            (anno_env) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #21

                              The idea is to use what is provided by Ubuntu rather than conda.

                              But before doing that, can you start your application with the QT_DEBUG_PLUGINS environment variable set to 1 ?

                              That will give you more information with what is happening with plugins.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              L 1 Reply Last reply
                              0
                              • L Offline
                                L Offline
                                lcleve
                                wrote on last edited by
                                #22

                                Based on what I found on web, I opened QtCreator: Tools-options-Environment-system-change. I added QT_DEBUG_PLUGINS=1, hit apply and ok. When I reopened the editor, the variable was there and set to 1. Re running the program as before yielded the same output in the vscode terminal. Should I look somewhere else ?

                                JonBJ 1 Reply Last reply
                                0
                                • L lcleve

                                  Based on what I found on web, I opened QtCreator: Tools-options-Environment-system-change. I added QT_DEBUG_PLUGINS=1, hit apply and ok. When I reopened the editor, the variable was there and set to 1. Re running the program as before yielded the same output in the vscode terminal. Should I look somewhere else ?

                                  JonBJ Online
                                  JonBJ Online
                                  JonB
                                  wrote on last edited by JonB
                                  #23

                                  @lcleve
                                  With that variable set you're supposed to get a whole bunch of output on stdout/stderr. I don't know about "vscode terminal". If you know how to run your Python script from a terminal you can set the variable there before running it and you should see the output.

                                  1 Reply Last reply
                                  0
                                  • SGaistS SGaist

                                    The idea is to use what is provided by Ubuntu rather than conda.

                                    But before doing that, can you start your application with the QT_DEBUG_PLUGINS environment variable set to 1 ?

                                    That will give you more information with what is happening with plugins.

                                    L Offline
                                    L Offline
                                    lcleve
                                    wrote on last edited by
                                    #24

                                    @SGaist Below are the results. This time the gui opened, but with the same distortions.

                                    (base) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ conda activate anno_env
                                    (anno_env) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ export QT_DEBUG_PLUGINS=1
                                    (anno_env) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ env
                                    SHELL=/bin/bash
                                    SESSION_MANAGER=local/jonathan-HP-Compaq-Elite-8300-USDT:@/tmp/.ICE-unix/1707,unix/jonathan-HP-Compaq-Elite-8300-USDT:/tmp/.ICE-unix/1707
                                    QT_ACCESSIBILITY=1
                                    COLORTERM=truecolor
                                    XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
                                    XDG_MENU_PREFIX=gnome-
                                    GNOME_DESKTOP_SESSION_ID=this-is-deprecated
                                    CONDA_EXE=/home/jonathan/anaconda3/bin/conda
                                    _CE_M=
                                    GNOME_SHELL_SESSION_MODE=ubuntu
                                    SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
                                    XMODIFIERS=@im=ibus
                                    DESKTOP_SESSION=ubuntu
                                    SSH_AGENT_PID=1663
                                    GTK_MODULES=gail:atk-bridge
                                    PWD=/home/jonathan
                                    LOGNAME=jonathan
                                    XDG_SESSION_DESKTOP=ubuntu
                                    XDG_SESSION_TYPE=x11
                                    CONDA_PREFIX=/home/jonathan/anaconda3/envs/anno_env
                                    GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
                                    XAUTHORITY=/run/user/1000/gdm/Xauthority
                                    GJS_DEBUG_TOPICS=JS ERROR;JS LOG
                                    WINDOWPATH=2
                                    HOME=/home/jonathan
                                    USERNAME=jonathan
                                    IM_CONFIG_PHASE=1
                                    LANG=en_US.UTF-8
                                    LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.webp=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:.xspf=00;36:
                                    XDG_CURRENT_DESKTOP=ubuntu:GNOME
                                    VTE_VERSION=6200
                                    CONDA_PROMPT_MODIFIER=(anno_env)
                                    GNOME_TERMINAL_SCREEN=/org/gnome/Terminal/screen/c167ca7d_7f2e_486d_97ba_108c9f87d984
                                    GJS_DEBUG_OUTPUT=stderr
                                    LESSCLOSE=/usr/bin/lesspipe %s %s
                                    XDG_SESSION_CLASS=user
                                    TERM=xterm-256color
                                    _CE_CONDA=
                                    LESSOPEN=| /usr/bin/lesspipe %s
                                    USER=jonathan
                                    GNOME_TERMINAL_SERVICE=:1.81
                                    CONDA_SHLVL=2
                                    DISPLAY=:0
                                    SHLVL=1
                                    QT_IM_MODULE=ibus
                                    QT_DEBUG_PLUGINS=1
                                    CONDA_PYTHON_EXE=/home/jonathan/anaconda3/bin/python
                                    XDG_RUNTIME_DIR=/run/user/1000
                                    CONDA_DEFAULT_ENV=anno_env
                                    XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
                                    PATH=/home/jonathan/anaconda3/envs/anno_env/bin:/home/jonathan/anaconda3/bin:/home/jonathan/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
                                    GDMSESSION=ubuntu
                                    DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
                                    CONDA_PREFIX_1=/home/jonathan/anaconda3
                                    _=/usr/bin/env
                                    (anno_env) jonathan@jonathan-HP-Compaq-Elite-8300-USDT:~$ python3 /home/jonathan/fullgui9JHC.gyp
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/plugins/platforms" ...
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqeglfs.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqeglfs.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                    "MetaData": {
                                    "Keys": [
                                    "eglfs"
                                    ]
                                    },
                                    "className": "QEglFSIntegrationPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("eglfs")
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqminimal.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqminimal.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                    "MetaData": {
                                    "Keys": [
                                    "minimal"
                                    ]
                                    },
                                    "className": "QMinimalIntegrationPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("minimal")
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqminimalegl.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqminimalegl.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                    "MetaData": {
                                    "Keys": [
                                    "minimalegl"
                                    ]
                                    },
                                    "className": "QMinimalEglIntegrationPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("minimalegl")
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqoffscreen.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqoffscreen.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                    "MetaData": {
                                    "Keys": [
                                    "offscreen"
                                    ]
                                    },
                                    "className": "QOffscreenIntegrationPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("offscreen")
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqvnc.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqvnc.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                    "MetaData": {
                                    "Keys": [
                                    "vnc"
                                    ]
                                    },
                                    "className": "QVncIntegrationPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("vnc")
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqxcb.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqxcb.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                                    "MetaData": {
                                    "Keys": [
                                    "xcb"
                                    ]
                                    },
                                    "className": "QXcbIntegrationPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("xcb")
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/bin/platforms" ...
                                    loaded library "/home/jonathan/anaconda3/envs/anno_env/plugins/platforms/libqxcb.so"
                                    loaded library "Xcursor"
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/plugins/xcbglintegrations" ...
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/xcbglintegrations/libqxcb-egl-integration.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/xcbglintegrations/libqxcb-egl-integration.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPA.Xcb.QXcbGlIntegrationFactoryInterface.5.5",
                                    "MetaData": {
                                    "Keys": [
                                    "xcb_egl"
                                    ]
                                    },
                                    "className": "QXcbEglIntegrationPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("xcb_egl")
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/xcbglintegrations/libqxcb-glx-integration.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/xcbglintegrations/libqxcb-glx-integration.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPA.Xcb.QXcbGlIntegrationFactoryInterface.5.5",
                                    "MetaData": {
                                    "Keys": [
                                    "xcb_glx"
                                    ]
                                    },
                                    "className": "QXcbGlxIntegrationPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("xcb_glx")
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/bin/xcbglintegrations" ...
                                    loaded library "/home/jonathan/anaconda3/envs/anno_env/plugins/xcbglintegrations/libqxcb-glx-integration.so"
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/plugins/platformthemes" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/bin/platformthemes" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/plugins/platforminputcontexts" ...
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
                                    "MetaData": {
                                    "Keys": [
                                    "compose",
                                    "xim"
                                    ]
                                    },
                                    "className": "QComposePlatformInputContextPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("compose", "xim")
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
                                    "MetaData": {
                                    "Keys": [
                                    "ibus"
                                    ]
                                    },
                                    "className": "QIbusPlatformInputContextPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("ibus")
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/platforminputcontexts/libqtvirtualkeyboardplugin.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
                                    "MetaData": {
                                    "Keys": [
                                    "qtvirtualkeyboard"
                                    ]
                                    },
                                    "className": "QVirtualKeyboardPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("qtvirtualkeyboard")
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/bin/platforminputcontexts" ...
                                    loaded library "/home/jonathan/anaconda3/envs/anno_env/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so"
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/plugins/styles" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/bin/styles" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/plugins/iconengines" ...
                                    QFactoryLoader::QFactoryLoader() looking at "/home/jonathan/anaconda3/envs/anno_env/plugins/iconengines/libqsvgicon.so"
                                    Found metadata in lib /home/jonathan/anaconda3/envs/anno_env/plugins/iconengines/libqsvgicon.so, metadata=
                                    {
                                    "IID": "org.qt-project.Qt.QIconEngineFactoryInterface",
                                    "MetaData": {
                                    "Keys": [
                                    "svg",
                                    "svgz",
                                    "svg.gz"
                                    ]
                                    },
                                    "className": "QSvgIconPlugin",
                                    "debug": false,
                                    "version": 329991
                                    }

                                    Got keys from plugin meta data ("svg", "svgz", "svg.gz")
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/bin/iconengines" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/plugins/accessible" ...
                                    QFactoryLoader::QFactoryLoader() checking directory path "/home/jonathan/anaconda3/envs/anno_env/bin/accessible" ...

                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #25

                                      Can you show the distortion you get ?

                                      I still suggest that you try to run your application with the Ubuntu provided PyQt5 to ensure it's something related to your conda installation and not your system.

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      L 1 Reply Last reply
                                      1
                                      • SGaistS SGaist

                                        Can you show the distortion you get ?

                                        I still suggest that you try to run your application with the Ubuntu provided PyQt5 to ensure it's something related to your conda installation and not your system.

                                        L Offline
                                        L Offline
                                        lcleve
                                        wrote on last edited by
                                        #26

                                        @SGaist I did that earlier today. Specifically, I used "conda create" to create an env with no specific packages specified. I then opened anaconda-navigator and added a single package, Pandas. Using the terminal on the activated env, I used "pip install pyqt5". At the command prompt of the activated env, I entered python app-path. The interface opened with distortions as follows:

                                        1. The text on buttons extends beyond the bounds of the buttons.
                                        2. It is impossible to click on the title bar and drag the window.
                                        3. No buttons or menu items work except for a "Start Here" button that pops up a message dialog.
                                        4. Previously, I had thought that the window was larger than 1920x1080, but the size is correct.
                                        5. If I kill the terminal, then the window can be moved by clicking and dragging the title bar. It can then be closed with the window close button.

                                        Sorry not to enclose a picture of the screen, but I am using an apple keyboard, which ,according to my knowledge, does not have a print screen button.

                                        In response to an above post, I installed Qt6. Do you think it might be worthwhile installing pyqt6 and creating an environment as described above?

                                        Thanks very much for your patience.

                                        lcleve

                                        1 Reply Last reply
                                        0
                                        • L Offline
                                          L Offline
                                          lcleve
                                          wrote on last edited by
                                          #27

                                          Did more work to completely eliminate conda and vs code as you suggested.
                                          Used python to create a virtual env.
                                          pip installed pyqt5.
                                          Tested it with simple hello world app and it worked.
                                          pip installed pandas.
                                          at the env prompt entered python myapp path.
                                          Initially it worked but with window problems described earlier.
                                          Re edited fonts with new Qt6 designer and font problems disappeared. My recollection is that I did this earlier. Don't know why it didn't work before.
                                          Changed min win size to 0x0. Now the window close button became visible (was off screen before) and the window could be closed.

                                          Evidently, there is some problem with conda. I was reluctant to abandon conda since in the past it was the only way we could get pandas installed with some other packages. Fortunately pandas and pyqt5 are coinstallable with the standard approach.

                                          Many thanks to all for suggestions and patience with a newcomer.

                                          lcleve

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved