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. Issues Running App on WSL2 Ubuntu / Win 11
QtWS25 Last Chance

Issues Running App on WSL2 Ubuntu / Win 11

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 2 Posters 1.5k Views
  • 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.
  • K Offline
    K Offline
    kbs_qt
    wrote on last edited by
    #1

    I want to make a small trading terminal application fairly quickly with similar functionality to other applications such as MetaTrader 5.
    I'm using WSL2 Ubuntu 22 inside a Windows 11 installation.

    I'm trying to run code from this quickstart:
    https://doc.qt.io/qtforpython-6/quickstart.html

    My hello_world.py code looks like this:

    import sys
    import random
    import os
    
    from PySide6 import QtCore, QtWidgets, QtGui
    
    class MyWidget(QtWidgets.QWidget):
        def __init__(self):
            super().__init__()
    
            self.hello = ["Hallo Welt", "Hei maailma", "Hola Mundo", "Привет мир"]
    
            self.button = QtWidgets.QPushButton("Click me!")
            self.text = QtWidgets.QLabel("Hello World",
                                         alignment=QtCore.Qt.AlignCenter)
    
            self.layout = QtWidgets.QVBoxLayout(self)
            self.layout.addWidget(self.text)
            self.layout.addWidget(self.button)
    
            self.button.clicked.connect(self.magic)
    
        @QtCore.Slot()
        def magic(self):
            self.text.setText(random.choice(self.hello))
    
    if __name__ == "__main__":
        app = QtWidgets.QApplication([])
    
        widget = MyWidget()
        widget.resize(800, 600)
        widget.show()
    
        sys.exit(app.exec())
    

    When I run python hello_world.py , I get this error:

    libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
    
    qt.qpa.wayland: Failed to initialize EGL display 3001
    

    I also noticed that the window that appears doesn't have any close or maximize boxes as is depicted in the tutorial.

    I'm concerned with the appearance of the window and the errors that I am getting, even though the button inside the window works fine.

    What should I do at this point, if anything?qt_app_error.png

    K 1 Reply Last reply
    0
    • K kbs_qt

      I want to make a small trading terminal application fairly quickly with similar functionality to other applications such as MetaTrader 5.
      I'm using WSL2 Ubuntu 22 inside a Windows 11 installation.

      I'm trying to run code from this quickstart:
      https://doc.qt.io/qtforpython-6/quickstart.html

      My hello_world.py code looks like this:

      import sys
      import random
      import os
      
      from PySide6 import QtCore, QtWidgets, QtGui
      
      class MyWidget(QtWidgets.QWidget):
          def __init__(self):
              super().__init__()
      
              self.hello = ["Hallo Welt", "Hei maailma", "Hola Mundo", "Привет мир"]
      
              self.button = QtWidgets.QPushButton("Click me!")
              self.text = QtWidgets.QLabel("Hello World",
                                           alignment=QtCore.Qt.AlignCenter)
      
              self.layout = QtWidgets.QVBoxLayout(self)
              self.layout.addWidget(self.text)
              self.layout.addWidget(self.button)
      
              self.button.clicked.connect(self.magic)
      
          @QtCore.Slot()
          def magic(self):
              self.text.setText(random.choice(self.hello))
      
      if __name__ == "__main__":
          app = QtWidgets.QApplication([])
      
          widget = MyWidget()
          widget.resize(800, 600)
          widget.show()
      
          sys.exit(app.exec())
      

      When I run python hello_world.py , I get this error:

      libEGL warning: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
      
      qt.qpa.wayland: Failed to initialize EGL display 3001
      

      I also noticed that the window that appears doesn't have any close or maximize boxes as is depicted in the tutorial.

      I'm concerned with the appearance of the window and the errors that I am getting, even though the button inside the window works fine.

      What should I do at this point, if anything?qt_app_error.png

      K Offline
      K Offline
      kbs_qt
      wrote on last edited by
      #2

      @kbs_qt following up on this question

      1 Reply Last reply
      0
      • F Offline
        F Offline
        friedemannkleint
        wrote on last edited by
        #3

        It seems those are the usual Wayland issues; can you run with X11? Is there any reason for using WSL at all - PySide also works on Windows.

        K 1 Reply Last reply
        2
        • F friedemannkleint

          It seems those are the usual Wayland issues; can you run with X11? Is there any reason for using WSL at all - PySide also works on Windows.

          K Offline
          K Offline
          kbs_qt
          wrote on last edited by
          #4

          @friedemannkleint I use WSL for most development tasks. Is WSL disadvantageous for this use case?

          And to run qt applications with x11, would I do this?

          export QT_QPA_PLATFORM=xcb

          1 Reply Last reply
          0
          • F Offline
            F Offline
            friedemannkleint
            wrote on last edited by
            #5

            I am not sure what GUI libraries/environment WSL supports. X11/XCB would be preferable.

            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