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. How to fix qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" error
Forum Updated to NodeBB v4.3 + New Features

How to fix qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" error

Scheduled Pinned Locked Moved Unsolved Qt for Python
qt for pythonpython
29 Posts 8 Posters 48.9k Views 3 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

    @Gokalp On Windows:

    set QT_DEBUG_PLUGINS=1
    
    G Offline
    G Offline
    Gokalp
    wrote on last edited by
    #11

    @jsulm still the sameaa.PNG

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

      Can you retry with an environment stored in a path without space or accented character ?

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

      G 1 Reply Last reply
      1
      • SGaistS SGaist

        Can you retry with an environment stored in a path without space or accented character ?

        G Offline
        G Offline
        Gokalp
        wrote on last edited by
        #13

        @SGaist How can i do that? My brother happened to be at home when this pc arrived so he made the username his name which contains Ö and Ğ characters... I tried to change the username several times but it never changed on the terminal so i really don't know what to do. Maybe there is another way that i can do what you're saying?

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

          Install your python environment in a folder starting from the root of your disk. For example "C:/Code/name_of_your_environment".

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

          G 1 Reply Last reply
          0
          • SGaistS SGaist

            Install your python environment in a folder starting from the root of your disk. For example "C:/Code/name_of_your_environment".

            G Offline
            G Offline
            Gokalp
            wrote on last edited by
            #15

            @SGaist Could you tell me how to do that? I have never used python that way since i didn't face any problems before

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

              How did you install Python ?
              How are you managing your virtual environments ?

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

              G 1 Reply Last reply
              0
              • SGaistS SGaist

                How did you install Python ?
                How are you managing your virtual environments ?

                G Offline
                G Offline
                Gokalp
                wrote on last edited by
                #17

                @SGaist I have never messed with environments, i installed python from its site and used it globally. All of my modues are also installed globally.

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

                  Then I would recommend reconsidering that modus operandi.

                  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
                  • G Gokalp

                    @SGaist I have never messed with environments, i installed python from its site and used it globally. All of my modues are also installed globally.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #19

                    @Gokalp said in How to fix qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" error:

                    i installed python from its site

                    Which site?
                    Using Python installer from official Python website allows you to select the installation folder.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    G 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @Gokalp said in How to fix qt.qpa.plugin: Could not find the Qt platform plugin "windows" in "" error:

                      i installed python from its site

                      Which site?
                      Using Python installer from official Python website allows you to select the installation folder.

                      G Offline
                      G Offline
                      Gokalp
                      wrote on last edited by
                      #20

                      @jsulm i installed it directly into the c folder

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

                        So what happens now ?

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

                        G 2 Replies Last reply
                        0
                        • SGaistS SGaist

                          So what happens now ?

                          G Offline
                          G Offline
                          Gokalp
                          wrote on last edited by
                          #22

                          @SGaist Will create an venv as soon as i understand how to do it and post the results for the pyqt5 debug

                          1 Reply Last reply
                          0
                          • SGaistS SGaist

                            So what happens now ?

                            G Offline
                            G Offline
                            Gokalp
                            wrote on last edited by
                            #23

                            @SGaist I created a venv under c:/ directly and it worked perfectly but i'm still confused why it worked on a computer named Göktuğ bu not on this computer named GÖTUĞ ALKAN while both have utf-8 characters in them

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

                              Might be the space in the path.

                              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
                              1
                              • Y Offline
                                Y Offline
                                YTKOHOC
                                wrote on last edited by
                                #25

                                I know it is looks like not an answer but stupid mistake, but I step on that rakes ones again and according to some questions on "StackOverflow" not only me.
                                I placed .exe file alongside with all .dlls by windeployqt and with folder plugins containing my plugin. The problem appears when I load plugin in my app. Solution is pretty simple: I run windeployqt for my .exe but my plugin.dll requires own specific dlls and I didn't place them along. Putting all .exe's and plugin's dlls together helped me to get rid of that message.

                                1 Reply Last reply
                                1
                                • J Offline
                                  J Offline
                                  joeyun
                                  wrote on last edited by
                                  #26

                                  I also encountered the same problem today
                                  25ca27d2-27a5-488e-8657-af754d6075fe-image.png
                                  I want to know exactly how to configure environment variables in the virtual environment of vscode??

                                  1 Reply Last reply
                                  0
                                  • N Offline
                                    N Offline
                                    nop144d
                                    wrote on last edited by
                                    #27

                                    An answer from ChatGPT just in case someone else finds it useful:

                                    **It seems like the application cannot find the Qt platform plugin, specifically the "windows" plugin, from its current location.

                                    Here's a potential solution for this issue:

                                    1. First, make sure that the platforms directory from your Qt installation is included in your application's distribution. The platforms directory will be located under your QT installation directory like <QtDirectory>/plugins/platforms/. In this directory, you should find a file called qwindows.dll. This file is the Qt platform plugin for Windows. It is essential to running any Qt application on Windows.

                                    2. Copy the entire platforms directory, and put it in the same directory as your application's executable.

                                    Here's an example of what your directory structure should look like:

                                    - YourApp.exe
                                    - platforms/
                                        - qwindows.dll
                                    - Other Qt DLLs like Qt5Core.dll, Qt5Gui.dll, etc.
                                    

                                    Make sure to include any other required DLLs in the main directory (the same place where YourApp.exe is located). These will typically include the ones you said you've already copied: Qt5Core.dll, Qt5Gui.dll, and so on, depending on what modules your application uses.

                                    When your application starts up, it will look for the platforms directory relative to its location. It will then load the platform plugin from there.

                                    If you've done this and it still doesn't work, you might need to make sure the application is being run with its working directory set to the directory containing the executable and the platforms directory. It's possible that the application is being started with a different working directory, and so it's not finding the platforms directory even though it's there. You can typically set the working directory in whatever method you're using to start the application.**

                                    JonBJ 1 Reply Last reply
                                    1
                                    • N nop144d

                                      An answer from ChatGPT just in case someone else finds it useful:

                                      **It seems like the application cannot find the Qt platform plugin, specifically the "windows" plugin, from its current location.

                                      Here's a potential solution for this issue:

                                      1. First, make sure that the platforms directory from your Qt installation is included in your application's distribution. The platforms directory will be located under your QT installation directory like <QtDirectory>/plugins/platforms/. In this directory, you should find a file called qwindows.dll. This file is the Qt platform plugin for Windows. It is essential to running any Qt application on Windows.

                                      2. Copy the entire platforms directory, and put it in the same directory as your application's executable.

                                      Here's an example of what your directory structure should look like:

                                      - YourApp.exe
                                      - platforms/
                                          - qwindows.dll
                                      - Other Qt DLLs like Qt5Core.dll, Qt5Gui.dll, etc.
                                      

                                      Make sure to include any other required DLLs in the main directory (the same place where YourApp.exe is located). These will typically include the ones you said you've already copied: Qt5Core.dll, Qt5Gui.dll, and so on, depending on what modules your application uses.

                                      When your application starts up, it will look for the platforms directory relative to its location. It will then load the platform plugin from there.

                                      If you've done this and it still doesn't work, you might need to make sure the application is being run with its working directory set to the directory containing the executable and the platforms directory. It's possible that the application is being started with a different working directory, and so it's not finding the platforms directory even though it's there. You can typically set the working directory in whatever method you're using to start the application.**

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

                                      @nop144d
                                      Shame that ChatGPT does not mention the very first debugging step for such an error message: set environment variable set QT_DEBUG_PLUGINS=1 and then run your executable: should get diagnostic output to determine what the issue is.

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        saga111a
                                        wrote on last edited by
                                        #29

                                        I had the same problem using virtual environment and pyqt5. This solved the problem:

                                        set "QT_PLUGIN_PATH=%VIRTUAL_ENV%\Lib\site-packages\PyQt5\Qt5\plugins"
                                        

                                        and I added this to the virtualenv activation script

                                        ....
                                        @set "PATH=%VIRTUAL_ENV%\Scripts;%PATH%"
                                        
                                        @set "QT_PLUGIN_PATH=%VIRTUAL_ENV%\Lib\site-packages\PyQt5\Qt5\plugins"  
                                        
                                        @if defined _OLD_CODEPAGE (
                                        ....
                                        
                                        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