<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Lorenzo,</p>
<p>you didn't mention which Linux distro you used and how you
installed numpy</p>
<p>I'm aware at least that on Alpine Linux, you need to install an
additional py3-numpy-dev package with the headers & lib needed
to use the C API of numpy, which is needed by the GDAL Python
bindings</p>
<p>Check that the following returns something sensible<br>
</p>
<p>python3 -c "import numpy; print(numpy.get_include())"</p>
<p>when you build the GDAL python bindings look for the following
messages in the output that will indicate that the gdal_array
module can't be built<br>
</p>
<p>"WARNING: numpy headers were not found! Array support will not
be enabled"</p>
<p>or<br>
</p>
<p>'WARNING: numpy not available! Array support will not be
enabled'</p>
<p>Even<br>
</p>
<div class="moz-cite-prefix">Le 24/09/2021 à 14:53, Lorenzo Di
Giacomo a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:CAERmyNQTiQ62gJonNYbPcysZ9XVNXZ25SajXV_KfT+NGBCgF8g@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Hi everyone, basically i build from source GDAL
3.2.2 and install the python bindings via pip3 install
gdal==3.2.2 <br>
<br>
Later i install numpy, i have read online that the numpy must be
installed before GDAL python bindings.<br>
So i tried to uninstall python gdal and than reinstall it, but
the problem still persists.<br>
<br>
Do you have any suggestions about it?<br>
<br>
Python3 libraries:<br>
GDAL 3.2.2<br>
NUMPY 1.21.2<br>
<br>
SWIG 4.0.2<br>
<br>
LOG:<br>
<pre style="margin-top:0px;margin-bottom:0px;border:0px">ModuleNotFoundError: No module named 'osgeo._gdal_array'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "temp-1544239507789228725main.py", line 98, in <module>
SSRD,gtSSRD = tiff2array(path_to_tiff, band_SSRD)
File "/hadoop/yarn/local/usercache/dispatcher/appcache/application_1628674283442_0030/container_e33_1628674283442_0030_01_000001/61a5101c-d78d-494d-b0d6-ef16719143719035222534140350861632485975806.zip/utility/rasterutils.py", line 58, in tiff2array
File "/usr/local/lib/python3.7/site-packages/osgeo/gdal.py", line 3832, in ReadAsArray
from osgeo import gdalnumeric
File "/usr/local/lib/python3.7/site-packages/osgeo/gdalnumeric.py", line 2, in <module>
from osgeo.gdal_array import *
File "/usr/local/lib/python3.7/site-packages/osgeo/gdal_array.py", line 17, in <module>
_gdal_array = swig_import_helper()
File "/usr/local/lib/python3.7/site-packages/osgeo/gdal_array.py", line 16, in swig_import_helper
return importlib.import_module('_gdal_array')
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named '_gdal_array'</pre>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>