[gdal-dev] Requiring numpy for the Python bindings

Greg Troxel gdt at lexort.com
Mon Dec 4 17:13:53 PST 2023


Even Rouault via gdal-dev <gdal-dev at lists.osgeo.org> writes:

> The current situation where numpy is an optional dependency of the
> GDAL Python bindings is quite cumbersome to deal with our setup.py's
> setuptools . All details (a bit tricky) in
> https://github.com/OSGeo/gdal/issues/8069 . It seems it would be
> simpler if the bindings just required numpy, which is the confugration
> most people using the bindings likely actually end up using anyway.

That seems ok, but I think it's important to realize how heavy it is.
numpy needs a Fortran compiler and a bunch of libs.  On NetBSD 9, that
leads to:

  Requires:
  gcc10>=10.3.0nb2
  python311>=3.11.0
  lapack>=3.9.0nb1
  cblas>=3.9.1nb1
  lapacke>=3.9.1nb2

which isn't bad compared to qgis, but it seems heavy compared to gdal.
Still, it's just build time, and none of those are things that don't
build.  Also, recent numpy explicitly requires gcc8, which isn't a real
problem, but it's newer than many LTS systems will have.

The big point is that numpy doesn't need rust, which seriously impairs
portability because there's a singleton compiler available for limited
platforms with a very difficult/recent self-hosting story.  Building the
rust compiler requires the *immediately preceding* compiler, which seems
unprecented, and I don't understand how people can think that's ok.  So
I think this is ok only if gdal people have understood the numpy
commmunity and think they would refrain from depending on rust.


More information about the gdal-dev mailing list