Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. qt python development - pyside2

qt python development - pyside2

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 5 Posters 16.3k 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.
  • H Offline
    H Offline
    hrs1
    wrote on 26 Jul 2018, 20:15 last edited by
    #1

    Trying to run Qt in Python using PySide2.
    But I am getting the following error:

    qt.qpa.plugin: Could not load the Qt platform plugin "windows" 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: minimal, offscreen, windows.
    

    My configuration is Windows 10 with Anaconda and python 3.6 (all latest versions).
    I have Qt installed and working (c:\qt) but it is not in the path environment variable so it shouldn't be causing problems.
    I noticed that qt library files (.dll) are present both in:

    1. C:\Users\user\Anaconda3\Lib\site-packages\PySide2
    2. C:\Users\user\Anaconda3\Library\bin
      I am running from within the Anaconda Prompt and the path environment variable starts with:
    • C:\Users\user\Anaconda3
    • C:\Users\user\Anaconda3\Library\mingw-w64\bin
    • C:\Users\user\Anaconda3\Library\usr\bin
    • C:\Users\user\Anaconda3\Library\bin
    • C:\Users\user\Anaconda3\Scripts
    • C:\Users\user\Anaconda3\bin

    I've searched various forums with similar problems, all pointing to path problems, but I haven't been able to find a solution

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 26 Jul 2018, 21:41 last edited by
      #2

      Hi,

      Since you are using conda, why are you trying to use your own installation of Qt ?
      You should rather use the dependencies that came with conda.

      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
      • H Offline
        H Offline
        hrs1
        wrote on 26 Jul 2018, 22:14 last edited by
        #3

        I am using conda's files.
        I just mentioned that the additional qt installation (used for c++ development) does not "clash" as its path is not present in the path environment variable.

        from the various posts online it seems that conda and qt don't "get along" too well.
        btw, I'm experiencing the same difficulties on another computer (again win-10 and conda)

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 27 Jul 2018, 16:56 last edited by
          #4

          Just in case, did you check that all your packages are coming from the same conda channel ?

          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 Offline
            G Offline
            giumas
            wrote on 27 Jul 2018, 22:52 last edited by
            #5

            Try to first set QT_DEBUG_PLUGINS=1 to get more info on what is failing: https://stackoverflow.com/a/51563781/2741329

            1 Reply Last reply
            1
            • H Offline
              H Offline
              hrs1
              wrote on 29 Jul 2018, 00:31 last edited by
              #6

              Thanks for the feedback.
              After setting the QT_DEBUG_PLUGINS environment flag, I get the following:

              QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/user/Anaconda3/Library/plugins/platforms" ...
              QFactoryLoader::QFactoryLoader() looking at "C:/Users/user/Anaconda3/Library/plugins/platforms/qminimal.dll"
              Found metadata in lib C:/Users/user/Anaconda3/Library/plugins/platforms/qminimal.dll, metadata=
              {
                  "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                  "MetaData": {
                      "Keys": [
                          "minimal"
                      ]
                  },
                  "className": "QMinimalIntegrationPlugin",
                  "debug": false,
                  "version": 329218
              }
              
              
              Got keys from plugin meta data ("minimal")
              QFactoryLoader::QFactoryLoader() looking at "C:/Users/user/Anaconda3/Library/plugins/platforms/qoffscreen.dll"
              Found metadata in lib C:/Users/user/Anaconda3/Library/plugins/platforms/qoffscreen.dll, metadata=
              {
                  "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                  "MetaData": {
                      "Keys": [
                          "offscreen"
                      ]
                  },
                  "className": "QOffscreenIntegrationPlugin",
                  "debug": false,
                  "version": 329218
              }
              
              
              Got keys from plugin meta data ("offscreen")
              QFactoryLoader::QFactoryLoader() looking at "C:/Users/user/Anaconda3/Library/plugins/platforms/qwindows.dll"
              Found metadata in lib C:/Users/user/Anaconda3/Library/plugins/platforms/qwindows.dll, metadata=
              {
                  "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                  "MetaData": {
                      "Keys": [
                          "windows"
                      ]
                  },
                  "className": "QWindowsIntegrationPlugin",
                  "debug": false,
                  "version": 329218
              }
              
              
              Got keys from plugin meta data ("windows")
              QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/user/Anaconda3/platforms" ...
              Cannot load library C:\Users\user\Anaconda3\Library\plugins\platforms\qwindows.dll: The specified procedure could not be found.
              QLibraryPrivate::loadPlugin failed on "C:/Users/user/Anaconda3/Library/plugins/platforms/qwindows.dll" : "Cannot load library C:\\Users\\user\\Anaconda3\\Library\\plugins\\platforms\\qwindows.dll: The specified procedure could not be found."
              qt.qpa.plugin: Could not load the Qt platform plugin "windows" 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: minimal, offscreen, windows.
              

              regarding conda channels, the following is a partial output of conda list (with qt related packages, and a few other packages):

              # Name                    Version                   Build  Channel
              pillow                    5.1.0            py36h0738816_0
              pip                       10.0.1                   py36_0
              pkginfo                   1.4.2                    py36_1
              pluggy                    0.6.0                    py36_0
              ply                       3.11                     py36_0
              progress                  1.4                      py36_0
              prometheus_client         0.3.0                    py36_0
              prompt_toolkit            1.0.15           py36h60b8f86_0
              protobuf                  3.5.2            py36h6538335_0
              psutil                    5.4.6            py36hfa6e2cd_0
              py                        1.5.4                    py36_0
              pyasn1                    0.4.3                    py36_0
              pyasn1-modules            0.2.2                    py36_0
              pycodestyle               2.4.0                    py36_0
              pycosat                   0.6.3            py36h413d8a4_0
              pycparser                 2.18                     py36_1
              pycrypto                  2.6.1            py36hfa6e2cd_9
              pycurl                    7.43.0.2         py36h74b6da3_0
              pyflakes                  2.0.0                    py36_0
              pygments                  2.2.0            py36hb010967_0
              pylint                    1.9.2                    py36_0
              pyodbc                    4.0.23           py36h6538335_0
              pyopenssl                 18.0.0                   py36_0
              pyparsing                 2.2.0                    py36_1
              pyqt                      5.6.0            py36hb5ed885_5
              PySide2                   5.11.0                    <pip>
              pysocks                   1.6.8                    py36_0
              pytables                  3.4.4            py36he6f6034_0
              pytest                    3.6.3                    py36_0
              pytest-arraydiff          0.2              py36h39e3cac_0
              pytest-astropy            0.4.0                    py36_0
              pytest-doctestplus        0.1.3                    py36_0
              pytest-openfiles          0.3.0                    py36_0
              pytest-remotedata         0.3.0                    py36_0
              python                    3.6.6                hea74fb7_0
              python-dateutil           2.7.3                    py36_0
              pytorch                   0.3.0                py36_0.3.0    peterjc123
              pytz                      2018.5                   py36_0
              pywin32                   223              py36hfa6e2cd_1
              pywinpty                  0.5.4                    py36_0
              pyyaml                    3.13             py36hfa6e2cd_0
              pyzmq                     17.0.0           py36hfa6e2cd_3
              qt                        5.6.2           vc14h6f8c307_12
              qtawesome                 0.4.4            py36h5aa48f6_0
              qtconsole                 4.3.1            py36h99a29a9_0
              qtpy                      1.4.2                    py36_0
              vc                        14.1                 h0510ff6_3
              vs2015_runtime            15.5.2                        3
              vs2017_runtime            15.5.2                        1
              
              1 Reply Last reply
              0
              • H Offline
                H Offline
                hrs1
                wrote on 29 Jul 2018, 01:08 last edited by
                #7

                Update:
                I uninstalled the pip version of PySide2
                and installed the conda-forge version

                now things seem to be working (at least a qt window opened...)

                thanks

                M 1 Reply Last reply 3 May 2019, 19:17
                0
                • H hrs1
                  29 Jul 2018, 01:08

                  Update:
                  I uninstalled the pip version of PySide2
                  and installed the conda-forge version

                  now things seem to be working (at least a qt window opened...)

                  thanks

                  M Offline
                  M Offline
                  metalshreds
                  wrote on 3 May 2019, 19:17 last edited by metalshreds 5 Mar 2019, 19:18
                  #8

                  I just ran into this problem and had the exact same output. From my troubleshooting it seems like qwindows.dll in Anaconda Library (C:/Users/user/Anaconda3/Library/plugins/platforms/qwindows.dll) is not the same as the one in the pyside2 folder, therefore it finds a qwindows.dll but it's not the correct one so it can't load it. I had to uninstall and reinstall Anaconda and then install pyside2 within the environment (creating an anaconda env in pycharm and installing pyside2 also through pycharm, but not using conda). Correct location for my qwindow.dll was C:/ProgramData/Anaconda3/envs/my_project/lib/site-packages/PySide2/plugins/platforms/qwindows.dll"

                  1 Reply Last reply
                  1
                  • A Offline
                    A Offline
                    abdufarag
                    wrote on 9 Jun 2020, 04:17 last edited by
                    #9

                    I have the same issue and fixed in this way
                    In Anaconda installation folder I went to : (change it to your installed path):

                    C:\ProgramData\Anaconda3\Lib\site-packages\PySide2

                    Edit this file by adding the following code lines :

                    # below the line 23 type.__signature__
                        pyside_package_dir =  os.path.abspath(os.path.dirname(__file__))
                        dirname = os.path.dirname(__file__)
                        plugin_path = os.path.join(dirname, 'plugins', 'platforms')
                        os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path
                    

                    save this file and try again and the issue should be gone :)

                    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