I have a qgis standalone program that is develop with python3.7/pyqt5.11 that come with the OSGEO4W's QGIS 3.4.4 (the latest LTR), it has the following imports:

import os, sys import sip from PyQt5 import QtCore, QtGui from PyQt5.QtGui import * from PyQt5.QtWidgets import QApplication from qgis.core import QgsApplication, QgsVectorLayer, QgsProject from qgis.gui import QgsProjectionSelectionDialog

Pyinstaller packaged it without problem, but when running its exe, it keeps saying:

Traceback (most recent call last): File "qgis_test.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' [7724] Failed to execute script qgis_test

When I added the PyQt5.QtPrintSupport to hiddenimport, it will complain about not finding the next QtXXX library (e.g. QtSql, QtNetwork...) and on and on. This type of thing has been a reoccurring theme with each of the QGIS's new releases, really wish they can be consistent with these packaging conventions.

How do I deal with this?

  • You should inform the osgeo4w team: trac.osgeo.org/osgeo4w/report. Bugs resulting from wrong packaging are fixed in shorttime normally. – Andreas Müller Feb 19 '19 at 9:25
  • @AndreasMüller thanks for the suggestion, I have requested osgeo userid, will wait for their approval, then i will try to learn how to create ticket on their trac site. Its funny that somehow I was under the impression that QGIS team actually has a partnership with gis.stackexchange to monitor for bug reports here... – For Comment Feb 19 '19 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.