[gdal-dev] [EXTERNAL] [BULK] OSX 13.4 (M1 Pro) troubles using GDAL

Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] jesse.r.meyer at nasa.gov
Wed Jun 21 09:04:58 PDT 2023


I checked which functions that were being exported from python3.11/site-packages/osgeo/_gdal.cpython-311-darwin.so

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.

This import line is ultimately what fails for me in test_env/lib/python3.11/site-packages/osgeo/gdal_array.py
# Import the low-level C/C++ module
if __package__ or "." in __name__:
    from . import _gdal_array

I see no _gdal_array file of any kind in /osgeo/.  Only _gdal, _gdalconst, _gnm, _ogr, and _osr .so files and the python wrappers.

I don’t know where these .so files are sourced from / generated (brew’s installation, pip?).

Hopefully this helped clarify the problem..
Jesse

From: gdal-dev <gdal-dev-bounces at lists.osgeo.org> on behalf of "Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev" <gdal-dev at lists.osgeo.org>
Reply-To: "Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC]" <jesse.r.meyer at nasa.gov>
Date: Tuesday, June 20, 2023 at 4:44 PM
To: "gdal-dev at lists.osgeo.org" <gdal-dev at lists.osgeo.org>
Subject: [EXTERNAL] [BULK] [gdal-dev] OSX 13.4 (M1 Pro) troubles using GDAL

Hi,

My GDAL installation procedure looks like:

Install python 3.11.4 from the official site
brew install gdal (this grabbed numpy v1.25, and a number of other pre-reqs, and installs 3.6.4)
python -m venv test_env
// activate test_env //
pip install numpy (installs v1.25)
pip install gdal==3.6.4 (brew does not yet house 3.7)

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`.

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.

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.

Any advice?  Thanks --
Jesse

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230621/cebe715d/attachment.htm>


More information about the gdal-dev mailing list