[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 10:19:58 PDT 2023


I went spelunking in brew’s folder structure and found _gdal_array.cpython-311-darwin.so.  So I just copied it over and problem solved. Not sure why that file was left out.

Hermeneutic solutions like conda at least prevent this kind of problem from occurring.

From: Paul Harwood <runette at gmail.com>
Date: Wednesday, June 21, 2023 at 12:38 PM
To: "Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC]" <jesse.r.meyer at nasa.gov>
Cc: "gdal-dev at lists.osgeo.org" <gdal-dev at lists.osgeo.org>
Subject: Re: [gdal-dev] [EXTERNAL] [BULK] OSX 13.4 (M1 Pro) troubles using GDAL

CAUTION: This email originated from outside of NASA.  Please take care when clicking links or opening attachments.  Use the "Report Message" button to report suspicious messages to the NASA SOC.


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.

However - I used Conda as the virtual environment and not Brew/Venv/Pip. I find it much more consistent and easier ...

On Wed, 21 Jun 2023 at 17:05, Meyer, Jesse R. (GSFC-618.0)[SCIENCE SYSTEMS AND APPLICATIONS INC] via gdal-dev <gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>> wrote:
I checked which functions that were being exported from python3.11/site-packages/osgeo/_gdal.cpython-311-darwin.so<http://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<mailto: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<mailto: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<mailto:jesse.r.meyer at nasa.gov>>
Date: Tuesday, June 20, 2023 at 4:44 PM
To: "gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>" <gdal-dev at lists.osgeo.org<mailto: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

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230621/2648c313/attachment-0001.htm>


More information about the gdal-dev mailing list