<div dir="ltr">Ah, awesome - thanks as ever for such great detail. <div><br></div><div>I've been trying with PYTHONPATH and sys.path, and I think I was doing it wrong ... but the simplicity of the /usr prefix had not occurred to me, I'll be doing that. </div><div><br></div><div>If I come back around with further insights I'll share them, but this is working for me now. </div><div><br></div><div>cmake .. -DCMAKE_INSTALL_PREFIX=/usr<br></div><div><br></div><div>Cheers, Mike</div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 8, 2023 at 1:35 PM Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Michael,</p>
<p>My experience is that understanding how and where to install
Python stuff is utterly difficult. And this is even more
complicated on Debian/Ubuntu that have many patches regarding
sys.path and distutils, plus the fact that distutils is deprecated
and going to be removed in Python 3.12, without a clear
replacement. Just look at all the horrible logic in
swig/python/CMakeLists.txt from line 428 to 504 +
swig/python/trimmedsysconfig.py +
swig/python/<a href="http://install_python.cmake.in" target="_blank">install_python.cmake.in</a>. Perhaps there's a better
way...<br>
</p>
<p>GDAL hopefully does the right thing for a typical distribution
installation where CMAKE_INSTALL_PREFIX=/usr . For other prefixes,
such as the implicit /usr/local prefix, you're on your own, and
you will likely have to set the PYTHONPATH environment variable to
point to /usr/local/lib/python3/dist-packages</p>
<p>GDAL_PYTHON_INSTALL_PREFIX will not help you here (and I'm not
sure to remember what the actual use case for it was)</p>
<p>Even<br>
</p>
<div>Le 08/03/2023 à 02:19, Michael Sumner a
écrit :<br>
</div>
<blockquote type="cite">
<div dir="ltr">Hello, apologies as this is not so much a GDAL but
a python question, but I'm interested in what others do,
hopefully I'm missing a key step that's not hacky :)
<div><br>
</div>
<div>I made a gist to record the details: </div>
<div><br>
</div>
<div><a href="https://gist.github.com/mdsumner/526af876cfddaa5ff245ab376b3cec84" target="_blank">https://gist.github.com/mdsumner/526af876cfddaa5ff245ab376b3cec84</a><br>
</div>
<div><br>
</div>
<div>The crux is, GDAL has placed the python osgeo lib files
into '/usr/local/lib/python3/dist-packages', but python is
only looking in '/usr/local/lib/python3.10/dist-packages' (as
seen in sys.path). <br>
<br>
Is there a config step with cmake, or a subsequent step with
python config that I should be doing? </div>
<div><br>
</div>
<div>Is it GDAL_PYTHON_INSTALL_PREFIX ?</div>
<div><br>
</div>
<div>Thank you. </div>
<div><br>
</div>
<div><br>
<span>-- </span><br>
<div dir="ltr">Michael Sumner<br>
Software and Database Engineer<br>
Australian Antarctic Division<br>
Hobart, Australia<br>
e-mail: <a href="mailto:mdsumner@gmail.com" target="_blank">mdsumner@gmail.com</a></div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre cols="72">--
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Michael Sumner<br>Software and Database Engineer<br>Australian Antarctic Division<br>Hobart, Australia<br>e-mail: <a href="mailto:mdsumner@gmail.com" target="_blank">mdsumner@gmail.com</a></div>