Bug report #21340

Standalone pyqgis application package development failure due to qgis.core dependency on PyQt5 libraries

Added by Tong Zhai over 1 year ago. Updated over 1 year ago.

Status:Closed
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:duplicate
Crashes QGIS or corrupts data:No Copied to github as #:29158

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\Py
Installer\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

qgis_test_issue.spec - PyInstaller spec file for building exe package (1013 Bytes) Tong Zhai, 2019-02-21 06:17 PM

qgis_test_issue.py Magnifier - Test standalone pyqgis application python source code (282 Bytes) Tong Zhai, 2019-02-21 06:17 PM


Related issues

Copied to QGIS Application - Bug report #21341: Standalone pyqgis application package development failure... Open 2019-02-21

History

#1 Updated by Giovanni Manghi over 1 year ago

  • Assignee deleted (Alessandro Pasotti)
  • Category changed from Windows Package to Build/Install

#2 Updated by Tong Zhai over 1 year ago

  • Copied to Bug report #21341: Standalone pyqgis application package development failure due to qgis.core dependency on PyQt5 libraries added

#3 Updated by Giovanni Manghi over 1 year ago

  • Resolution set to duplicate
  • Status changed from Open to Closed

Also available in: Atom PDF