[QGIS-Developer] Packaging Qgis standalone python app with PyInstaller

VOLPES-EXT, Jacky Jacky.VOLPES-EXT at canal-de-provence.com
Wed Aug 28 00:23:50 PDT 2019


Hello QGIS dev team,

Currently I am developping a standalone python app and I am now working on the packaging with PyInstaller.

Configuration :

-          OS : Windows 10

-          QGIS : 3.4.9

-          PyInstaller : 3.5


Pyinstaller correctly finds many dependencies and manages to create an executable.
When I run it, the output is :

  File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "qgis\gui\__init__.py", line 27, in <module>
RuntimeError: qgis._gui cannot import type '����' from PyQt5.QtCore
[6752] Failed to execute script main

When it reaches the line `from qgis.gui import QgsMapCanvas`


I found that the sip folder in QGIS 3.4\apps\Python37\ contains many files that might be useful, so I manually added the content of sip\PyQt5 in the PyInstaller package with other PyQt5 stuff and the new output is :

  File "C:\PROGRA~1\QGIS3~1.4\apps\Python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
    exec(bytecode, module.__dict__)
  File "qgis\gui\__init__.py", line 27, in <module>
RuntimeError: the PyQt5.Qsci module failed to register with the sip module
[4092] Failed to execute script main


After many google research I found this issue (https://github.com/qgis/QGIS/issues/31166) which gave me the idea to ask for help on this mailing list.
I hope I am on the right mailing list !

Any idea about a file or folder I forgot to package ?
For PyInstaller I use a default .spec file.

Thanks a lot,
Best regards

Jacky Volpes
HR Team pour la Société du Canal de Provence | 2SI - QGIS
Le Tholonet, CS70064
jacky.volpes-ext at canal-de-provence.com<mailto:jacky.volpes-ext at canal-de-provence.com>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190828/cfc8feaf/attachment-0001.html>


More information about the QGIS-Developer mailing list