<div dir="ltr">To state the (I hope) obvious - it must be a problem with your installation and not a general problem with GDAL on Mac - I just tried it on a fresh installation and it worked.<br><br>However - I used Conda as the virtual environment and not Brew/Venv/Pip. I find it much more consistent and easier ...</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 21 Jun 2023 at 17:05, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev <<a href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</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 class="msg6370848579663135071">





<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="m_6370848579663135071WordSection1">
<p class="MsoNormal">I checked which functions that were being exported from python3.11/site-packages/osgeo/_<a href="http://gdal.cpython-311-darwin.so" target="_blank">gdal.cpython-311-darwin.so</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">And found a few IO-esque functions, including _GDALReadBlock and _Band_ReadRaster.  Calling these via the standard bindings work.  Must be how rasterio is operating under the hood.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This import line is ultimately what fails for me in test_env/lib/python3.11/site-packages/osgeo/gdal_array.py<u></u><u></u></p>
<p class="MsoNormal" style="line-height:13.5pt;background:rgb(45,42,46)"><i><span style="font-size:9pt;font-family:Menlo;color:rgb(114,112,114)"># Import the low-level C/C++ module</span></i><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:13.5pt;background:rgb(45,42,46)"><span style="font-size:9pt;font-family:Menlo;color:rgb(255,97,136)">if</span><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)">
</span><span style="font-size:9pt;font-family:Menlo;color:rgb(120,220,232)">__package__</span><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)">
</span><span style="font-size:9pt;font-family:Menlo;color:rgb(255,97,136)">or</span><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)">
</span><span style="font-size:9pt;font-family:Menlo;color:rgb(147,146,147)">"</span><span style="font-size:9pt;font-family:Menlo;color:rgb(255,216,102)">.</span><span style="font-size:9pt;font-family:Menlo;color:rgb(147,146,147)">"</span><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)">
</span><span style="font-size:9pt;font-family:Menlo;color:rgb(255,97,136)">in</span><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)">
</span><span style="font-size:9pt;font-family:Menlo;color:rgb(120,220,232)">__name__</span><span style="font-size:9pt;font-family:Menlo;color:rgb(147,146,147)">:</span><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)"><u></u><u></u></span></p>
<p class="MsoNormal" style="line-height:13.5pt;background:rgb(45,42,46)"><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)">   
</span><span style="font-size:9pt;font-family:Menlo;color:rgb(255,97,136)">from</span><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)">
</span><span style="font-size:9pt;font-family:Menlo;color:rgb(147,146,147)">.</span><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)">
</span><span style="font-size:9pt;font-family:Menlo;color:rgb(255,97,136)">import</span><span style="font-size:9pt;font-family:Menlo;color:rgb(252,252,250)"> _gdal_array<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I see no _<i>gdal</i>_array file of any kind in /osgeo/.  Only _gdal, _gdalconst, _gnm, _ogr, and _osr .so files and the python wrappers.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I don’t know where these .so files are sourced from / generated (brew’s installation, pip?).
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Hopefully this helped clarify the problem..<br>
Jesse<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12pt;color:black">From:
</span></b><span style="font-size:12pt;color:black">gdal-dev <<a href="mailto:gdal-dev-bounces@lists.osgeo.org" target="_blank">gdal-dev-bounces@lists.osgeo.org</a>> on behalf of "Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev" <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>><br>
<b>Reply-To: </b>"Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC]" <<a href="mailto:jesse.r.meyer@nasa.gov" target="_blank">jesse.r.meyer@nasa.gov</a>><br>
<b>Date: </b>Tuesday, June 20, 2023 at 4:44 PM<br>
<b>To: </b>"<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>" <<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>><br>
<b>Subject: </b>[EXTERNAL] [BULK] [gdal-dev] OSX 13.4 (M1 Pro) troubles using GDAL<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
</div>
<p class="MsoNormal">Hi,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">My GDAL installation procedure looks like:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Install python 3.11.4 from the official site<u></u><u></u></p>
<p class="MsoNormal">brew install gdal (this grabbed numpy v1.25, and a number of other pre-reqs, and installs 3.6.4)<u></u><u></u></p>
<p class="MsoNormal">python -m venv test_env<u></u><u></u></p>
<p class="MsoNormal">// activate test_env //<u></u><u></u></p>
<p class="MsoNormal">pip install numpy (installs v1.25)<u></u><u></u></p>
<p class="MsoNormal">pip install gdal==3.6.4 (brew does not yet house 3.7)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This appears to work fine at first.  I can manipulate gdal datasets up until I use band.ReadAsArray().  Python throws an exception `cannot import name '_gdal_array' from 'osgeo`.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Should this have worked?  Stack Overflow has a few instances of this problem and they all point to incorrect install orders, or various software environments interacting poorly.  But I don’t think I’m making those mistakes.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">What causes my head to spin is that, I installed rasterio, and the ‘read’ function works!  It must be via a different mechanism, but I wasn’t able to follow the code architecture in Github to see how they pull it off.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Any advice?  Thanks --<u></u><u></u></p>
<p class="MsoNormal">Jesse  <u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</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>
</div></blockquote></div>