[gdal-dev] Best Practices For Using GDAL As a Dependency In a Python Package?
Sean Gillies
sean.gillies at gmail.com
Mon Mar 31 19:09:24 PDT 2025
Hi Adriano,
I'm the maintainer of Rasterio and have been distributing wheels that
include GDAL on PyPI for a few years. I do not recommend the experience of
doing this. I'm writing a blog post about it, but it's not done yet. The
TL;DR is: it's hard, there's endless toil, and you spend time interacting
with the worst open source people. The ones who only want free compiled
ready-to-run software (and your labor for free), and who don't contribute
to your project in any positive way.
Publishing a GDAL-dependent package to conda-forge is much less work
because the GDAL package already exists and has maintainers.
if you decide you really want to publish software that uses GDAL on PyPI in
spite of my warning, do read https://pypackaging-native.github.io/ and
especially these sections:
* https://pypackaging-native.github.io/key-issues/native-dependencies/
*
https://pypackaging-native.github.io/key-issues/native-dependencies/geospatial_stack/
* https://pypackaging-native.github.io/meta-topics/user_expectations_wheels/
I wish Ralf Gommers had written this before I started! If you have
questions about those sections, you can discuss them on GitHub with Ralf,
or we could discuss GDAL-specific issues here. One problem specific to GDAL
is that of format drivers, and which ones to include.
Yours,
On Mon, Mar 31, 2025 at 7:05 PM Adriano Matos via gdal-dev <
gdal-dev at lists.osgeo.org> wrote:
> Hello,
>
> I've been writing a Python package that uses GDAL as a dependency. I plan
> to make this package available to install via Anaconda at least. Having a
> pip package would be nice, but I keep getting GDAL errors whenever I try to
> compile a pip package. I think it has something to do with the
> system-dependent compilers that GDAL uses. I was able to successfully
> create an Anaconda package, but as of now it is only available to install
> via Windows. I wanted to make this package system-agnostic, but it
> defaulted to my system's OS of Windows when I created the package due to
> the use of GDAL as a dependency. I was considering creating an Anaconda
> package in a Linux environment (maybe using a virtual machine) and then a
> Mac environment so that I can have this package available on all operating
> systems. I was curious to see if anyone knows more about this topic. Am I
> approaching this problem the right way? Thank you!
>
--
Sean Gillies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250331/abc6b831/attachment.htm>
More information about the gdal-dev
mailing list