Skip to content

Plugin incompatible with QGIS 3.44+ (Qt6) - PyQt5 imports need updating #96

@Chunnhooo

Description

@Chunnhooo

The Hotspot Analysis plugin fails to load in QGIS 3.44+ with the error as I shown in Figure below.
ImportError: PyQt5 classes cannot be imported in a QGIS build based on Qt6.

Following the PySAL fix from Stack Exchange, I updated these imports in the plugin files:

  • Changed hotspot_analysis.py:
    Updated PySAL imports to use pysal.explore.esda and pysal.lib.weights
  • Changed PyQt5 imports to qgis.PyQt
  • Changed hotspot_analysis_dialog.py:
    Replaced from PyQt5 import QtCore, QtGui, QtWidgets with from qgis.PyQt import ...
  • Changed resources.py
    Replaced from PyQt5 import QtCore with from qgis.PyQt import QtCore
    Result:
    Still getting the same Qt6 compatibility error after restarting QGIS.
    Question:
    Are there other files that need updating, or is there a different approach needed for Qt6 compatibility? Any guidance would be appreciated.
Image This is my environment: QGIS Version: 3.44.0-Solothurn Plugin Version: 2.0.0 Operating System: Windows 10/11 Python Version: 3.12.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions