-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make modelchecker tests work with numpy 2.0 #378
Comments
Looked at this with Casper and since GDAL does not support numpy 2, we currently cannot either. |
How about locking the numpy version for testing to <2.0 (in https://github.com/nens/threedigrid-builder/blob/master/setup.py#L63)? @caspervdw @leendertvanwolfswinkel |
We actually have two environments that threedi-modelchecker should run in:
I think it might be best to do an automated test with numpy 2 and without GDAL, and an automated test with the GDAL + numpy versions in use in QGis (maybe using a docker like https://github.com/OSGeo/gdal/pkgs/container/gdal/236116077?tag=ubuntu-small-3.9.1) This BTW also goes from threedigrid-builder, but not for threedi-tables which should only run in the backend. threedi-schema has no depedency on numpy. |
Many of the tests fail when executed with numpy<2, rasterio, and no gdal; not just gdal tests. All of them are in |
How do you mean fail with numpy<2? Why would they fail if no dependency was changed? |
I assume because they are usually run with GDAL installed; when I install pygdal 3.4.1.10 they run fine. My point is that testing with rasterio and numpy 2 but no GDAL might be a challenge, considering that many tests don't even seem to pass with rasterio, numpy 1, and no GDAL. |
So the modelchecker works in QGis (with GDAL delivered by Qgis) and in the backend ("workers" module in threedi-api). This is the environment where the modelchecker should work: https://github.com/nens/threedi-api/blob/master/workers I see numpy 1.19, rasterio 1.3.10, and also gdal (https://github.com/nens/threedi-api/blob/bffdb1945efba0397d8e7be3fbfe5df0536f157c/workers/Dockerfile#L13C1-L14C1) So it seems that all environments use GDAL, and not rasterio. Now I am confused, why is the whole rasterio there then in modelchecker? @daanvaningen @martijn-siemerink do you have an idea? |
Until this is resolved, I've put in a NumPy 1 pin: |
Apparently it does work, as long as you make sure GDAL is built against numpy 2. The following does the trick:
Ref: https://numpy.org/doc/stable/user/building.html#numpy-2-0-specific-advice
For QGis, this issue will for sure be addressed by QGis. We just need to adhere to whathever GDAL/numpy versions they prescribe. |
Managed to get NumPy 2 and GDAL working together in an action. According to the release description of rasterio 1.3.10, the latest release and the first to support NumPy 2:
Since Python 3.8 security updates will end on 31 October anyway, this doesn't seem like a major issue. |
Numpy 2.0 is only supported by python 3.9 to 3.12 (https://numpy.org/news/) and so any user with 3.8 will get numpy 1.x. If I understand you correctly @elisalle that will still work. |
No description provided.
The text was updated successfully, but these errors were encountered: