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 get DLLs from Qt5 to work with python standalone script using pyQGIS/PyQT5 ?
Forum Updated to NodeBB v4.3 + New Features

How to get DLLs from Qt5 to work with python standalone script using pyQGIS/PyQT5 ?

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 2.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.
  • N Offline
    N Offline
    NH-forumuser
    wrote on 7 Mar 2020, 00:27 last edited by
    #1

    Hello All,

    I have been trying to create a standalone Python script to work using pyQGIS. However when trying to run a script that opens an existing QGIS on disk the I get the following error

    qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "C:\OSGEO4~1\apps\Qt5\plugins" 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: direct2d, minimal, offscreen, windows.

    When I used the QT_DEBUG_PLUGINS to trace the error in more detail I got the following large block of traceback

    QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGEO4~1/apps/Qt5/plugins" ...
    QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGeo4W64/apps/Python37" ...
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGeo4W64/apps/Python37/python3.dll"
    "Failed to extract plugin meta data from 'C:/OSGeo4W64/apps/Python37/python3.dll'" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGeo4W64/apps/Python37/python37.dll"
    "Failed to extract plugin meta data from 'C:/OSGeo4W64/apps/Python37/python37.dll'" 
             not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGEO4~1/apps/Qt5/plugins/platforms" ...
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2d.dll"
    Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2d.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "direct2d"
            ]
        },
        "className": "QWindowsDirect2DIntegrationPlugin",
        "debug": false,
        "version": 330498
    }
    
    
    Got keys from plugin meta data ("direct2d")
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2dd.dll"
    Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2dd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "direct2d"
            ]
        },
        "className": "QWindowsDirect2DIntegrationPlugin",
        "debug": true,
        "version": 330498
    }
    
    
    "The plugin 'C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2dd.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimal.dll"
    Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimal.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "className": "QMinimalIntegrationPlugin",
        "debug": false,
        "version": 330498
    }
    
    
    Got keys from plugin meta data ("minimal")
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimald.dll"
    Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimald.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "minimal"
            ]
        },
        "className": "QMinimalIntegrationPlugin",
        "debug": true,
        "version": 330498
    }
    
    
    "The plugin 'C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimald.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreen.dll"
    Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreen.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "className": "QOffscreenIntegrationPlugin",
        "debug": false,
        "version": 330498
    }
    
    
    Got keys from plugin meta data ("offscreen")
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreend.dll"
    Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreend.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "offscreen"
            ]
        },
        "className": "QOffscreenIntegrationPlugin",
        "debug": true,
        "version": 330498
    }
    
    
    "The plugin 'C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreend.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll"
    Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "windows"
            ]
        },
        "className": "QWindowsIntegrationPlugin",
        "debug": false,
        "version": 330498
    }
    
    
    Got keys from plugin meta data ("windows")
    QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindowsd.dll"
    Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindowsd.dll, metadata=
    {
        "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
        "MetaData": {
            "Keys": [
                "windows"
            ]
        },
        "className": "QWindowsIntegrationPlugin",
        "debug": true,
        "version": 330498
    }
    
    
    "The plugin 'C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindowsd.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
             not a plugin
    QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGeo4W64/apps/Python37/platforms" ...
    Cannot load library C:\OSGEO4~1\apps\Qt5\plugins\platforms\qwindows.dll: The specified procedure could not be found.
    QLibraryPrivate::loadPlugin failed on "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll" : "Cannot load library C:\\OSGEO4~1\\apps\\Qt5\\plugins\\platforms\\qwindows.dll: The specified procedure could not be found."
    qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "C:\OSGEO4~1\apps\Qt5\plugins" 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: direct2d, minimal, offscreen, windows.
    

    The python script I was trying to run is the following

    import os
    import sys
    
    os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = r'C:\OSGEO4~1\apps\Qt5\plugins'
    os.environ['QT_DEBUG_PLUGINS'] = '1'
    os.environ['PATH'] += r'C:\OSGEO4~1\apps\Qt5\bin; C:\OSGeo4W64\apps\qgis\bin'
    sys.path.extend([r'C:\OSGeo4W64\apps\qgis\python', r'C:\OSGeo4W64\apps\Python37\lib\site-packages'])
    
    from qgis.core import *
    from PyQt5 import *
    
    
    QgsApplication.setPrefixPath(r'C:\OSGEO4~1\apps\qgis', True)
    
    qgs = QgsApplication([], False)
    
    qgs.initQgis()
    
    QGIS_project = QgsProject.instance()
    print(QGIS_project)
    QGIS_project.read('Path to QGIS Project')
    
    print(QGIS_project)
    map_layers = QGIS_project.mapLayers()
    print(map_layers)
    raster_layer = QGIS_project.mapLayersByName('DigitialSurfaceModel')
    shapefile_layer = QGIS_project.mapLayersByName('test_shp')
    
    print(raster_layer)
    print(shapefile_layer)
    

    if anyone has ideas of how I could go about fixing this problem that would be wonderful.

    JonBJ 1 Reply Last reply 7 Mar 2020, 09:24
    0
    • N NH-forumuser
      7 Mar 2020, 00:27

      Hello All,

      I have been trying to create a standalone Python script to work using pyQGIS. However when trying to run a script that opens an existing QGIS on disk the I get the following error

      qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "C:\OSGEO4~1\apps\Qt5\plugins" 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: direct2d, minimal, offscreen, windows.

      When I used the QT_DEBUG_PLUGINS to trace the error in more detail I got the following large block of traceback

      QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGEO4~1/apps/Qt5/plugins" ...
      QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGeo4W64/apps/Python37" ...
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGeo4W64/apps/Python37/python3.dll"
      "Failed to extract plugin meta data from 'C:/OSGeo4W64/apps/Python37/python3.dll'" 
               not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGeo4W64/apps/Python37/python37.dll"
      "Failed to extract plugin meta data from 'C:/OSGeo4W64/apps/Python37/python37.dll'" 
               not a plugin
      QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGEO4~1/apps/Qt5/plugins/platforms" ...
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2d.dll"
      Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2d.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "direct2d"
              ]
          },
          "className": "QWindowsDirect2DIntegrationPlugin",
          "debug": false,
          "version": 330498
      }
      
      
      Got keys from plugin meta data ("direct2d")
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2dd.dll"
      Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2dd.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "direct2d"
              ]
          },
          "className": "QWindowsDirect2DIntegrationPlugin",
          "debug": true,
          "version": 330498
      }
      
      
      "The plugin 'C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2dd.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
               not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimal.dll"
      Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimal.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "minimal"
              ]
          },
          "className": "QMinimalIntegrationPlugin",
          "debug": false,
          "version": 330498
      }
      
      
      Got keys from plugin meta data ("minimal")
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimald.dll"
      Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimald.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "minimal"
              ]
          },
          "className": "QMinimalIntegrationPlugin",
          "debug": true,
          "version": 330498
      }
      
      
      "The plugin 'C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimald.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
               not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreen.dll"
      Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreen.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "offscreen"
              ]
          },
          "className": "QOffscreenIntegrationPlugin",
          "debug": false,
          "version": 330498
      }
      
      
      Got keys from plugin meta data ("offscreen")
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreend.dll"
      Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreend.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "offscreen"
              ]
          },
          "className": "QOffscreenIntegrationPlugin",
          "debug": true,
          "version": 330498
      }
      
      
      "The plugin 'C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreend.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
               not a plugin
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll"
      Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "windows"
              ]
          },
          "className": "QWindowsIntegrationPlugin",
          "debug": false,
          "version": 330498
      }
      
      
      Got keys from plugin meta data ("windows")
      QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindowsd.dll"
      Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindowsd.dll, metadata=
      {
          "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
          "MetaData": {
              "Keys": [
                  "windows"
              ]
          },
          "className": "QWindowsIntegrationPlugin",
          "debug": true,
          "version": 330498
      }
      
      
      "The plugin 'C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindowsd.dll' uses incompatible Qt library. (Cannot mix debug and release libraries.)" 
               not a plugin
      QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGeo4W64/apps/Python37/platforms" ...
      Cannot load library C:\OSGEO4~1\apps\Qt5\plugins\platforms\qwindows.dll: The specified procedure could not be found.
      QLibraryPrivate::loadPlugin failed on "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll" : "Cannot load library C:\\OSGEO4~1\\apps\\Qt5\\plugins\\platforms\\qwindows.dll: The specified procedure could not be found."
      qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "C:\OSGEO4~1\apps\Qt5\plugins" 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: direct2d, minimal, offscreen, windows.
      

      The python script I was trying to run is the following

      import os
      import sys
      
      os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = r'C:\OSGEO4~1\apps\Qt5\plugins'
      os.environ['QT_DEBUG_PLUGINS'] = '1'
      os.environ['PATH'] += r'C:\OSGEO4~1\apps\Qt5\bin; C:\OSGeo4W64\apps\qgis\bin'
      sys.path.extend([r'C:\OSGeo4W64\apps\qgis\python', r'C:\OSGeo4W64\apps\Python37\lib\site-packages'])
      
      from qgis.core import *
      from PyQt5 import *
      
      
      QgsApplication.setPrefixPath(r'C:\OSGEO4~1\apps\qgis', True)
      
      qgs = QgsApplication([], False)
      
      qgs.initQgis()
      
      QGIS_project = QgsProject.instance()
      print(QGIS_project)
      QGIS_project.read('Path to QGIS Project')
      
      print(QGIS_project)
      map_layers = QGIS_project.mapLayers()
      print(map_layers)
      raster_layer = QGIS_project.mapLayersByName('DigitialSurfaceModel')
      shapefile_layer = QGIS_project.mapLayersByName('test_shp')
      
      print(raster_layer)
      print(shapefile_layer)
      

      if anyone has ideas of how I could go about fixing this problem that would be wonderful.

      JonBJ Online
      JonBJ Online
      JonB
      wrote on 7 Mar 2020, 09:24 last edited by
      #2

      @NH-forumuser
      I admit I know nothing about pyQGIS, but a couple of times in the output you get

      uses incompatible Qt library. (Cannot mix debug and release libraries.)

      Don't you think you should address that?

      JKSHJ 1 Reply Last reply 7 Mar 2020, 12:03
      2
      • JonBJ JonB
        7 Mar 2020, 09:24

        @NH-forumuser
        I admit I know nothing about pyQGIS, but a couple of times in the output you get

        uses incompatible Qt library. (Cannot mix debug and release libraries.)

        Don't you think you should address that?

        JKSHJ Offline
        JKSHJ Offline
        JKSH
        Moderators
        wrote on 7 Mar 2020, 12:03 last edited by JKSH 3 Jul 2020, 12:03
        #3

        Hi, and welcome!

        @JonB said in How to get DLLs from Qt5 to work with python standalone script using pyQGIS/PyQT5 ?:

        @NH-forumuser
        I admit I know nothing about pyQGIS, but a couple of times in the output you get

        uses incompatible Qt library. (Cannot mix debug and release libraries.)

        Don't you think you should address that?

        @JonB is right. The Qt DLLs whose filenames end with "d" (qwindowsd.dll, qoffscreend.dll) are Debug versions. You should only be using Release builds (qwindows.dll, qoffscreen.dll) in deployed applications.

        Furthermore, you have "Cannot load library C:\OSGEO4~1\apps\Qt5\plugins\platforms\qwindows.dll: The specified procedure could not be found." That usually means you have mixed binaries that are built by different compilers. DLLs/executables that are built by MinGW are incompatible with DLLs/executables that are built by MSVC, for example.

        How did you install pyQGIS/QGIS?

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        N 1 Reply Last reply 13 Mar 2020, 16:24
        3
        • JKSHJ JKSH
          7 Mar 2020, 12:03

          Hi, and welcome!

          @JonB said in How to get DLLs from Qt5 to work with python standalone script using pyQGIS/PyQT5 ?:

          @NH-forumuser
          I admit I know nothing about pyQGIS, but a couple of times in the output you get

          uses incompatible Qt library. (Cannot mix debug and release libraries.)

          Don't you think you should address that?

          @JonB is right. The Qt DLLs whose filenames end with "d" (qwindowsd.dll, qoffscreend.dll) are Debug versions. You should only be using Release builds (qwindows.dll, qoffscreen.dll) in deployed applications.

          Furthermore, you have "Cannot load library C:\OSGEO4~1\apps\Qt5\plugins\platforms\qwindows.dll: The specified procedure could not be found." That usually means you have mixed binaries that are built by different compilers. DLLs/executables that are built by MinGW are incompatible with DLLs/executables that are built by MSVC, for example.

          How did you install pyQGIS/QGIS?

          N Offline
          N Offline
          NH-forumuser
          wrote on 13 Mar 2020, 16:24 last edited by NH-forumuser
          #4

          @JKSH Hello, I believe it was a software package install from OSGeo website and it came preinstalled along with QGIS. It is the version Qt 5.11.2.0. I tired to put the debug dll's in a separate folder with only the release builds remaining the in the folder however I am still getting an error that I cannot load the library qwindows.dll even though it was found.

          Error code in question

          C:\OSGeo4W64\apps\Python37\python.exe C:/Users/BCIT_student/Documents/Standalone_scripts/createSamplePoints.py
          QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGEO4~1/apps/Qt5/plugins" ...
          QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGeo4W64/apps/Python37" ...
          QFactoryLoader::QFactoryLoader() looking at "C:/OSGeo4W64/apps/Python37/python3.dll"
          "Failed to extract plugin meta data from 'C:/OSGeo4W64/apps/Python37/python3.dll'" 
                   not a plugin
          QFactoryLoader::QFactoryLoader() looking at "C:/OSGeo4W64/apps/Python37/python37.dll"
          "Failed to extract plugin meta data from 'C:/OSGeo4W64/apps/Python37/python37.dll'" 
                   not a plugin
          QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGEO4~1/apps/Qt5/plugins/platforms" ...
          QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2d.dll"
          Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2d.dll, metadata=
          {
              "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
              "MetaData": {
                  "Keys": [
                      "direct2d"
                  ]
              },
              "className": "QWindowsDirect2DIntegrationPlugin",
              "debug": false,
              "version": 330498
          }
          
          
          Got keys from plugin meta data ("direct2d")
          QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimal.dll"
          Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimal.dll, metadata=
          {
              "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
              "MetaData": {
                  "Keys": [
                      "minimal"
                  ]
              },
              "className": "QMinimalIntegrationPlugin",
              "debug": false,
              "version": 330498
          }
          
          
          Got keys from plugin meta data ("minimal")
          QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreen.dll"
          Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreen.dll, metadata=
          {
              "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
              "MetaData": {
                  "Keys": [
                      "offscreen"
                  ]
              },
              "className": "QOffscreenIntegrationPlugin",
              "debug": false,
              "version": 330498
          }
          
          
          Got keys from plugin meta data ("offscreen")
          QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll"
          Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll, metadata=
          {
              "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
              "MetaData": {
                  "Keys": [
                      "windows"
                  ]
              },
              "className": "QWindowsIntegrationPlugin",
              "debug": false,
              "version": 330498
          }
          
          
          Got keys from plugin meta data ("windows")
          QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGeo4W64/apps/Python37/platforms" ...
          Cannot load library C:\OSGEO4~1\apps\Qt5\plugins\platforms\qwindows.dll: The specified procedure could not be found.
          QLibraryPrivate::loadPlugin failed on "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll" : "Cannot load library C:\\OSGEO4~1\\apps\\Qt5\\plugins\\platforms\\qwindows.dll: The specified procedure could not be found."
          qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "C:\OSGEO4~1\apps\Qt5\plugins" 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: direct2d, minimal, offscreen, windows.
          
          
          Process finished with exit code -1073740791 (0xC0000409)
          

          The windows batch file used to initialize the OSGeo4W install

          @echo off
          set OSGEO4W_ROOT=C:\OSGeo4W64
          call %OSGEO4W_ROOT%\bin\o4w_env.bat
          call %OSGEO4W_ROOT%\apps\grass\grass78\etc\env.bat
          
          REM PATH setup
          path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
          path %PATH%;%OSGEO4W_ROOT%\apps\Python37\Scripts
          path %PATH%;%OSGEO4W_ROOT%\apps\Qt5\bin
          
          REM QGIS setup
          set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\apps\qgis
          set QT_QPA_PLATFORM_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\Qt5\plugins\platforms
          set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
          
          REM GRASS setup
          set GRASSBIN=%OSGEO4W_ROOT%\bin\grass78.bat
          set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\grass\grass78\etc\python
          
          REM Python home
          set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python37
          
          N 1 Reply Last reply 13 Mar 2020, 17:17
          0
          • N NH-forumuser
            13 Mar 2020, 16:24

            @JKSH Hello, I believe it was a software package install from OSGeo website and it came preinstalled along with QGIS. It is the version Qt 5.11.2.0. I tired to put the debug dll's in a separate folder with only the release builds remaining the in the folder however I am still getting an error that I cannot load the library qwindows.dll even though it was found.

            Error code in question

            C:\OSGeo4W64\apps\Python37\python.exe C:/Users/BCIT_student/Documents/Standalone_scripts/createSamplePoints.py
            QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGEO4~1/apps/Qt5/plugins" ...
            QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGeo4W64/apps/Python37" ...
            QFactoryLoader::QFactoryLoader() looking at "C:/OSGeo4W64/apps/Python37/python3.dll"
            "Failed to extract plugin meta data from 'C:/OSGeo4W64/apps/Python37/python3.dll'" 
                     not a plugin
            QFactoryLoader::QFactoryLoader() looking at "C:/OSGeo4W64/apps/Python37/python37.dll"
            "Failed to extract plugin meta data from 'C:/OSGeo4W64/apps/Python37/python37.dll'" 
                     not a plugin
            QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGEO4~1/apps/Qt5/plugins/platforms" ...
            QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2d.dll"
            Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qdirect2d.dll, metadata=
            {
                "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                "MetaData": {
                    "Keys": [
                        "direct2d"
                    ]
                },
                "className": "QWindowsDirect2DIntegrationPlugin",
                "debug": false,
                "version": 330498
            }
            
            
            Got keys from plugin meta data ("direct2d")
            QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimal.dll"
            Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qminimal.dll, metadata=
            {
                "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                "MetaData": {
                    "Keys": [
                        "minimal"
                    ]
                },
                "className": "QMinimalIntegrationPlugin",
                "debug": false,
                "version": 330498
            }
            
            
            Got keys from plugin meta data ("minimal")
            QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreen.dll"
            Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qoffscreen.dll, metadata=
            {
                "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                "MetaData": {
                    "Keys": [
                        "offscreen"
                    ]
                },
                "className": "QOffscreenIntegrationPlugin",
                "debug": false,
                "version": 330498
            }
            
            
            Got keys from plugin meta data ("offscreen")
            QFactoryLoader::QFactoryLoader() looking at "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll"
            Found metadata in lib C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll, metadata=
            {
                "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
                "MetaData": {
                    "Keys": [
                        "windows"
                    ]
                },
                "className": "QWindowsIntegrationPlugin",
                "debug": false,
                "version": 330498
            }
            
            
            Got keys from plugin meta data ("windows")
            QFactoryLoader::QFactoryLoader() checking directory path "C:/OSGeo4W64/apps/Python37/platforms" ...
            Cannot load library C:\OSGEO4~1\apps\Qt5\plugins\platforms\qwindows.dll: The specified procedure could not be found.
            QLibraryPrivate::loadPlugin failed on "C:/OSGEO4~1/apps/Qt5/plugins/platforms/qwindows.dll" : "Cannot load library C:\\OSGEO4~1\\apps\\Qt5\\plugins\\platforms\\qwindows.dll: The specified procedure could not be found."
            qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "C:\OSGEO4~1\apps\Qt5\plugins" 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: direct2d, minimal, offscreen, windows.
            
            
            Process finished with exit code -1073740791 (0xC0000409)
            

            The windows batch file used to initialize the OSGeo4W install

            @echo off
            set OSGEO4W_ROOT=C:\OSGeo4W64
            call %OSGEO4W_ROOT%\bin\o4w_env.bat
            call %OSGEO4W_ROOT%\apps\grass\grass78\etc\env.bat
            
            REM PATH setup
            path %PATH%;%OSGEO4W_ROOT%\apps\qgis\bin
            path %PATH%;%OSGEO4W_ROOT%\apps\Python37\Scripts
            path %PATH%;%OSGEO4W_ROOT%\apps\Qt5\bin
            
            REM QGIS setup
            set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\apps\qgis
            set QT_QPA_PLATFORM_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\Qt5\plugins\platforms
            set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\qgis\python
            
            REM GRASS setup
            set GRASSBIN=%OSGEO4W_ROOT%\bin\grass78.bat
            set PYTHONPATH=%PYTHONPATH%;%OSGEO4W_ROOT%\apps\grass\grass78\etc\python
            
            REM Python home
            set PYTHONHOME=%OSGEO4W_ROOT%\apps\Python37
            
            N Offline
            N Offline
            NH-forumuser
            wrote on 13 Mar 2020, 17:17 last edited by
            #5

            @NH-forumuser

            Hello All, I believe a solution has been found

            added the call %OSGEO4W_ROOT%\bin\qt5_env.bat inside the calls below inside the windows batch file

            @echo off
            set OSGEO4W_ROOT=C:\OSGeo4W64
            call %OSGEO4W_ROOT%\bin\o4w_env.bat
            call %OSGEO4W_ROOT%\apps\grass\grass78\etc\env.bat
            

            and it worked.

            1 Reply Last reply
            1
            • hskoglundH hskoglund referenced this topic on 2 May 2025, 22:17

            1/5

            7 Mar 2020, 00:27

            • Login

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