[gdal-dev] Packages on PyPi vs. Ubuntu/Fedora

Stefan Blumentrath Stefan.Blumentrath at nina.no
Mon Sep 30 05:02:55 PDT 2019


Hi Even,

And thanks for your swift reply.

If I install Python bindings like:
pip3 install gdal==2.4.2
installation works fine.

However, if I then install nansat:
pip3 install nansat
then pip3 tries to re-install GDALs python bindings for GDAL version 3 (which fails).

So, users are caught up in package-mismatches and I was wondering if it would be possible to have something like:

import subprocess
gdal_version = None
try:
    gdal_version = subprocess.check_output(['gdal-config', '--version']).decode('utf8').strip('\n')
except:
    print('Warning: Could not identify GDAL version, using default!')
if not gdal_version:
    gdal_version = '3.0.0'
    
in setup.py for the Python bindings.

But maybe that messes too much with how pip is supposed to work...?

Cheers
Stefan

-----Original Message-----
From: Even Rouault <even.rouault at spatialys.com> 
Sent: mandag 30. september 2019 12:35
To: gdal-dev at lists.osgeo.org
Cc: Stefan Blumentrath <Stefan.Blumentrath at nina.no>
Subject: Re: [gdal-dev] Packages on PyPi vs. Ubuntu/Fedora

On lundi 30 septembre 2019 08:19:41 CEST Stefan Blumentrath wrote:
> Hi gdal-devs,
> 
> GDAL on PyPi is already at version 3, while e.g. Ubuntu and Fedora 
> still ship GDAL 2. Thus, downstream Python packages that do not 
> particularly specify to depend on GDAL <3 fail to build via pip3, 
> cause pip3 tires to install Python bindings for GDAL 3, which is missing on the system.
> 
> Would it be possible for the GDAL package on PyPi to check for and 
> pick up the (latest) GDAL version installed in the system?

I don't think that's something GDAL has control over. This is a pure pip behaviour. Users should definitely specify the version of GDAL for which they have the native library installed.

Even

--
Spatialys - Geospatial professional services http://www.spatialys.com


More information about the gdal-dev mailing list