NumPy compatibility issue with QSWAT+ 3.1.2 on QGIS 3.44.8 (Python 3.12)

16 views
Skip to first unread message

Awel Seid

unread,
Mar 17, 2026, 11:13:40 AMMar 17
to qs...@googlegroups.com
Dear Chris George and SWAT+ User Group,

I recently encountered a problem while trying to run QSWAT+ (version 3.1.2) on QGIS 3.44.8 (Solothurn) with Python 3.12 on Windows. The plugin failed to initialize with the following traceback:

2026-03-17T17:05:40     INFO    QSWAT+ failed to import HRUs: Traceback (most recent call last):
  File "...\QSWATPlus\QSWATPlus\QSWATPlusMain.py", line 55, in <module>
    from .hrus import HRUs
  File "...\qgis\utils.py", line 1100, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "...\QSWATPlus\QSWATPlus\hrus.py", line 50, in <module>
    from .polygonizeInC2 import Polygonize
  File "...\qgis\utils.py", line 1100, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "polygonizeInC2.pyx", line 1, in init QSWATPlus.polygonizeInC2
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

The error indicates a binary incompatibility between the precompiled Cython extension `polygonizeInC2` and the installed NumPy version. Initially, NumPy was version 2.4.2 (later upgraded to 2.4.3 without success). The extension expected a data type size of 96, but the runtime NumPy reported 88. After some investigation, I found that downgrading NumPy to version 1.26.4 resolved the issue completely. The plugin now loads and functions as expected.

Environment details:
- QGIS version: 3.44.8 (Solothurn)
- QSWAT+ version: 3.1.2
- Python version: 3.12
- Operating System: Windows 11
- NumPy version (before fix): 2.4.3 → (after fix): 1.26.4

Possible cause:
The precompiled `.pyd` files (e.g., `polygonizeInC2.cp312-win_amd64.pyd`) were likely built against NumPy 1.x, which uses an older ABI. NumPy 2.x introduced ABI changes, leading to the size mismatch. Downgrading to NumPy 1.26.4 restores compatibility.

Request:
If possible, could future releases of QSWAT+ include updated Cython extensions compiled against NumPy 2.x? Alternatively, providing a note in the installation instructions about the required NumPy version would help other users encountering the same issue.

Thank you for your excellent work on QSWAT+

Best regards,  

Awel Seid Mekonnen (M.Sc)
Lecturer at Hawassa University, Institute of Technology
Department of Water Resources and Irrigation Engineering
PhD candidate in Irrigation and Drainage Engineering (at Adama Science and Technology University)
P.O.Box: 1459
Hawassa,SNNPRS, Ethiopia

Chris George

unread,
Mar 17, 2026, 12:09:52 PMMar 17
to Awel Seid, qs...@googlegroups.com
Thank you for your comments. I am glad you were able to resolve the
issue. There are many possible version incompatibility problems
involved with QSWAT and QSWAT+: Python and GDAL for example as well as
Numpy and a number of other Python packages. There are further issues
with different operating systems: Windows, Linux, Mac (Intel and ARM)
etc. Rather than trying to cater for all possibilities we recommend
particular QGIS versions (currently 3.40) and try to ensure QGIS works
with that version. You choose to use 3.44 and so take the risk of there
being problems.

Chris


On 3/17/2026 3:12 PM, Awel Seid wrote:
> Dear Chris George and SWAT+ User Group, I recently encountered a problem
> while trying to run QSWAT+ (version 3. 1. 2) on QGIS 3. 44. 8
> (Solothurn) with Python 3. 12 on Windows. The plugin failed to
> initialize with the following traceback: 2026-03-17T17: 05: 40
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
> ZjQcmQRYFpfptBannerEnd
> Dear Chris George and SWAT+User Group,
> */Awel Seid Mekonnen (M.Sc)/*
> ///Lecturer at Hawassa University, Institute of Technology
> /
> /Department of Water Resources//////and Irrigation Engineering
> /
> /PhD candidate in Irrigation and Drainage Engineering (at Adama Science
> and Technology University)/
> /P.O.Box: 1459/
> /Email: awel...@hu.edu.et <mailto:awel...@hu.edu.et> OR
> awel...@gmail.com <mailto:awel...@gmail.com>
> /
> /Web.: http://www.hu.edu.et/hu/ <https://urldefense.com/v3/__http://
> www.hu.edu.et/hu/__;!!KwNVnqRv!
> FO1tCiTYsqLW0XwNfrp8JYoVt8ACwlJjJNHPYTjBHleAstarJOJoYseypv2vf7He9mqqaxV64fabcsnB$>
> /
> _/Hawassa,SNNPRS, Ethiopia/_
>
> --
> You received this message because you are subscribed to the Google
> Groups "QSWAT" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to qswat+un...@googlegroups.com
> <mailto:qswat+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/qswat/
> CACCB0AWm%2BCXeDGwLozfi%3DDLaajmx4p%2Bf6xARRXFPZ310m2MtTw%40mail.gmail.com <https://urldefense.com/v3/__https://groups.google.com/d/msgid/qswat/CACCB0AWm*2BCXeDGwLozfi*3DDLaajmx4p*2Bf6xARRXFPZ310m2MtTw*40mail.gmail.com?utm_medium=email&utm_source=footer__;JSUlJQ!!KwNVnqRv!FO1tCiTYsqLW0XwNfrp8JYoVt8ACwlJjJNHPYTjBHleAstarJOJoYseypv2vf7He9mqqaxV64UQhNmZQ$>.

Reply all
Reply to author
Forward
0 new messages