[Distutils] How to add GDAL as a dependency to a Python package

Nathaniel Smith njs at pobox.com
Wed Apr 13 16:33:46 EDT 2016


On Wed, Apr 13, 2016 at 11:31 AM, Chris Barker <chris.barker at noaa.gov> wrote:
>
> On Wed, Apr 13, 2016 at 12:02 AM, Luí­s de Sousa <luis.de.sousa at protonmail.ch> wrote:
>>
>> Thank you for the reply Chris.
>>
>> I just tried to install pygdal directly from PiPY on a stock Ubuntu distribution and it fails [0], even if I supposedly have all the necessary headers installed.
>
>
> I took a quick look, and it looks like the buld/install failed on numpy -- numpy is a dependency of gdal. so you may want to get numpy installed first.

Yeah, due to various infelicities in the distutils stack, automated
dependency installation when building stuff is pretty wonky, and a lot
of things need numpy to be installed before you try building them. So
doing 'pip install numpy' first is a good idea before trying to
install any of the rest of the numerical stack. (Part of the
motivation for PEP 516/517 is to fix this.)

> (that surprises me -- I thought numpy built out of the box pretty easily -- if not with an optimized BLAS) and it looks like it did build, but somehow failed to install....

Thanks to Matthew Brett's tireless efforts (hat tip to Zhang Xianyi
for fixing a bunch of bugs in OpenBLAS just for us), there are now[1]
numpy linux wheels with optimized BLAS up on PyPI, so if you have pip
>= 8.1.0, then 'pip install numpy' should Just Work on linux without
needing a compiler at all (and likewise on windows and osx).

-n

[1] now = "since ~1 hour ago" ;-)

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Distutils-SIG mailing list