How to get DLLs from Qt5 to work with python standalone script using pyQGIS/PyQT5 ?
-
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.
-
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.
@NH-forumuser
I admit I know nothing aboutpyQGIS
, but a couple of times in the output you getuses incompatible Qt library. (Cannot mix debug and release libraries.)
Don't you think you should address that?
-
@NH-forumuser
I admit I know nothing aboutpyQGIS
, but a couple of times in the output you getuses incompatible Qt library. (Cannot mix debug and release libraries.)
Don't you think you should address that?
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 aboutpyQGIS
, but a couple of times in the output you getuses 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?
-
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 aboutpyQGIS
, but a couple of times in the output you getuses 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?
@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
-
@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
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.