<div dir="ltr">setting gdal as a dependency is only going to work if one of these is true:<div><br></div><div>* 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)</div><div><br></div><div>* 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)</div><div> - 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.</div><div><br></div><div>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 :-)</div><div><br></div><div>-CHB</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 12, 2016 at 5:24 AM, Luís de Sousa <span dir="ltr"><<a href="mailto:distutils-sig@python.org" target="_blank">distutils-sig@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><p>Dear all,<br></p><div>I am trying to package a Python script for PyPI that uses GDAL. I started by including a direct reference in my <code>setup.py</code>:<br></div><p><code>install_requires=['GDAL==1.11.2'],</code><br></p><p>This way the package failed to install in my test virtual environment:<br></p><pre><code><span>extensions</span><span>/</span><span>gdal_wrap</span><span>.</span><span>cpp</span><span>:</span><span>2855</span><span>:</span><span>22</span><span>:</span><span> fatal error</span><span>:</span><span> cpl_port</span><span>.</span><span>h</span><span>:</span><span> </span><span>No</span><span> such file </span><span>or</span><span> directory
</span><span>#include "cpl_port.h"</span><span>
</span><span>^</span><span>
compilation terminated</span><span>.</span><span>
error</span><span>:</span><span> </span><span>Setup</span><span> script exited </span><span>with</span><span> error</span><span>:</span><span> command </span><span>'x86_64-linux-gnu-gcc'</span><span> failed </span><span>with</span><span> exit status </span><span>1</span></code><br></pre><p>I then tried it with a reference to <code>pygdal</code>, since it is marked as a virtualenv friendly version:<br></p><p><code>install_requires=['pygdal'],</code><br></p><p>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:<br></p><pre><code><span>Traceback</span><span> </span><span>(</span><span>most recent call last</span><span>):</span><span>
</span><span>File</span><span> </span><span>"/home/desouslu/.virtualenvs/test_p3/bin/hasc2gml"</span><span>,</span><span> line </span><span>5</span><span>,</span><span> </span><span>in</span><span> </span><span><</span><span>module</span><span>></span><span>
</span><span>from</span><span> pkg_resources </span><span>import</span><span> load_entry_point
</span><span>File</span><span> </span><span>"/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py"</span><span>,</span><span> line </span><span>2716</span><span>,</span><span> </span><span>in</span><span> </span><span><</span><span>module</span><span>></span><span>
working_set</span><span>.</span><span>require</span><span>(</span><span>__requires__</span><span>)</span><span>
</span><span>File</span><span> </span><span>"/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py"</span><span>,</span><span> line </span><span>685</span><span>,</span><span> </span><span>in</span><span> require
needed </span><span>=</span><span> self</span><span>.</span><span>resolve</span><span>(</span><span>parse_requirements</span><span>(</span><span>requirements</span><span>))</span><span>
</span><span>File</span><span> </span><span>"/home/desouslu/.virtualenvs/test_p3/lib/python3.4/site-packages/pkg_resources.py"</span><span>,</span><span> line </span><span>588</span><span>,</span><span> </span><span>in</span><span> resolve
</span><span>raise</span><span> </span><span>DistributionNotFound</span><span>(</span><span>req</span><span>)</span><span>
pkg_resources</span><span>.</span><span>DistributionNotFound</span><span>:</span><span> pygdal</span></code><br></pre><p>What is the correct way of setting GDAL as a dependency?<br></p><div>Thank you,<br></div><div><br></div><div>Luís<br></div></div><div><br></div><div><i>Sent from <a href="https://protonmail.ch" target="_blank">ProtonMail</a>, encrypted email based in Switzerland.</i><br></div><br>_______________________________________________<br>
Distutils-SIG maillist - <a href="mailto:Distutils-SIG@python.org">Distutils-SIG@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/distutils-sig" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/distutils-sig</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R (206) 526-6959 voice<br>7600 Sand Point Way NE (206) 526-6329 fax<br>Seattle, WA 98115 (206) 526-6317 main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div>