[Distutils] How to add GDAL as a dependency to a Python package
Chris Barker
chris.barker at noaa.gov
Tue Apr 12 12:45:35 EDT 2016
setting gdal as a dependency is only going to work if one of these is true:
* There is a binary wheel on PyPi for gdal (which is very hard to do,
though with teh manylinux effort, maybe there will be some day)
* the system on which you are trying to install is all set up to compile
gdal -- which is a major effort, and indeed, I'm not sure is possible (I
haven't looked)
- The GDAL source ships with the python bindings, so the usual thing is
for gdal itself and the pyton bindings to all get compiled and installed at
once. I"m not srue that anyone has made a setup.py that will do that.
This kind of thing is exactly why conda exists -- python packages with
complex non-python dependencies are not well handled by pip / pypi -- if I
were you, I"d give it a try :-)
-CHB
On Tue, Apr 12, 2016 at 5:24 AM, Luís de Sousa <distutils-sig at python.org>
wrote:
> Dear all,
> I am trying to package a Python script for PyPI that uses GDAL. I started
> by including a direct reference in my setup.py:
>
> install_requires=['GDAL==1.11.2'],
>
> This way the package failed to install in my test virtual environment:
>
> extensions/gdal_wrap.cpp:2855:22: fatal error: cpl_port.h: No such file or directory
> #include "cpl_port.h"
> ^
> compilation terminated.
> error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
>
> I then tried it with a reference to pygdal, since it is marked as a
> virtualenv friendly version:
>
> install_requires=['pygdal'],
>
> This way the installation finishes without errors (but with the usual load
> of compilation warnings). However, when then I invoke the script I get this
> error back:
>
> Traceback (most recent call last):
> File "/home/desouslu/.virtualenvs/test_p3/bin/hasc2gml", line 5, in <module>
> from pkg_resources import load_entry_point
> File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 2716, in <module>
> working_set.require(__requires__)
> File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 685, in require
> needed = self.resolve(parse_requirements(requirements))
> File "/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py", line 588, in resolve
> raise DistributionNotFound(req)
> pkg_resources.DistributionNotFound: pygdal
>
> What is the correct way of setting GDAL as a dependency?
> Thank you,
>
> Luís
>
> *Sent from ProtonMail <https://protonmail.ch>, encrypted email based in
> Switzerland.*
>
> _______________________________________________
> Distutils-SIG maillist - Distutils-SIG at python.org
> https://mail.python.org/mailman/listinfo/distutils-sig
>
>
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20160412/35515405/attachment.html>
More information about the Distutils-SIG
mailing list