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
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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.
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 Resourcesand Irrigation Engineering
PhD candidate in Irrigation and Drainage Engineering (at Adama Science and Technology University)
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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,