We have built standalone pyqgis application in QGIS 2.x with Python 2.7, it worked and also we could package the application with standard package setting using PyInstaller. However, ever since we migrated to QGIS 3.x with Python 3, PyInstaller package building has been unsuccessful. The latest LTR QGIS 3.4.4 failed to support pyinstaller packaging also.
Below are the details:
We installed the QGIS software using OSGEO4W installer (osgeo4w-setup-x86_64.exe) on a windows 7 desktop
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
PYQT_VERSION_STR: 5.11.3
Qgis.QGIS_VERSION: '3.4.4-Madeira'
Attached files:
The test standalone qgis application runs in the PyCharm develop environment, this file is attached (qgis_test_issue.py)
PyInstaller (version 3.4) spec file for the test python file is also attached (qgis_test_issue.spec)
The packaging process can run to completion, but when running the packaged 'qgis_test_issue.exe', it always complains about missing Qt5 libraries upon qgis.core import:
Traceback (most recent call last):
File "qgis_test_issue.py", line 6, in <module>
from qgis.core import QgsApplication, QgsVectorLayer, QgsProject
File "c:\OSGEO4~1\apps\Python37\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "qgis\core\__init__.py", line 27, in <module>
ModuleNotFoundError: No module named 'PyQt5.QtPrintSupport'
[6792] Failed to execute script qgis_test_issue
I also ran a script to get the following library path settings from the version 3.4.4 OSGeo4W installation:
Author Name: Tong Zhai (Tong Zhai) Original Redmine Issue: 21341 Affected QGIS version: 3.4.4 Redmine category:build/install
We have built standalone pyqgis application in QGIS 2.x with Python 2.7, it worked and also we could package the application with standard package setting using PyInstaller. However, ever since we migrated to QGIS 3.x with Python 3, PyInstaller package building has been unsuccessful. The latest LTR QGIS 3.4.4 failed to support pyinstaller packaging also.
Below are the details: We installed the QGIS software using OSGEO4W installer (osgeo4w-setup-x86_64.exe) on a windows 7 desktop Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32 PYQT_VERSION_STR: 5.11.3 Qgis.QGIS_VERSION: '3.4.4-Madeira'
Attached files: The test standalone qgis application runs in the PyCharm develop environment, this file is attached (qgis_test_issue.py) PyInstaller (version 3.4) spec file for the test python file is also attached (qgis_test_issue.spec)
The packaging process can run to completion, but when running the packaged 'qgis_test_issue.exe', it always complains about missing Qt5 libraries upon qgis.core import:
I also ran a script to get the following library path settings from the version 3.4.4 OSGeo4W installation:
Related issue(s): #29158 (copied_to) Redmine related issue(s): 21340