Bug report #21341
Standalone pyqgis application package development failure due to qgis.core dependency on PyQt5 libraries
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Build/Install | ||
Affected QGIS version: | 3.4.4 | Regression?: | No |
Operating System: | Windows 7 | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 29159 |
Description
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:
{'isDebugBuild': False, 'location': {'ArchDataPath': 'C:/OSGEO4~1/apps/Qt5', 'BinariesPath': 'C:/OSGEO4~1/apps/Qt5/bin', 'DataPath': 'C:/OSGEO4~1/apps/Qt5', 'DocumentationPath': 'C:/OSGEO4~1/apps/Qt5/doc', 'ExamplesPath': 'C:/OSGEO4~1/apps/Qt5/examples', 'HeadersPath': 'C:/OSGEO4~1/apps/Qt5/include', 'ImportsPath': 'C:/OSGEO4~1/apps/Qt5/imports', 'LibrariesPath': 'C:/OSGEO4~1/apps/Qt5/lib', 'LibraryExecutablesPath': 'C:/OSGEO4~1/apps/Qt5/bin', 'PluginsPath': 'C:/OSGEO4~1/apps/Qt5/plugins', 'PrefixPath': 'C:/OSGEO4~1/apps/Qt5', 'Qml2ImportsPath': 'C:/OSGEO4~1/apps/Qt5/qml', 'SettingsPath': '', 'TestsPath': 'C:/OSGEO4~1/apps/Qt5/tests', 'TranslationsPath': 'C:/OSGEO4~1/apps/Qt5/translations'}, 'version': [5, 11, 2]}
Related issues
History
#1 Updated by Tong Zhai almost 6 years ago
- Copied from Bug report #21340: Standalone pyqgis application package development failure due to qgis.core dependency on PyQt5 libraries added