[gdal-dev] Test problem After Merge

Even Rouault even.rouault at spatialys.com
Tue Apr 30 06:18:36 PDT 2024


Andrew,

first, check that you can use the command line utilities like gdalinfo, 
so you may need to adjust your PATH, DYLD_LIBRARY_PATH and GDAL_DATA. 
The Bash script scripts/setdevenv.sh might help setting up stuff (not 
totally sure if it works on Mac though).

Also try in a Python interpreter "from osgeo import gdal" to see if the 
exception is more verbose. If your GDAL lib links against libraries that 
are not in the default library search path, GDAL command line utilities 
might still be able to find them, but loading libgdal through the Python 
bindings might fail (at least that happens to me on Linux, cf 
https://github.com/OSGeo/gdal/pull/9783)

Also try otool -L on libgdal.dylib and on _gdal.cpython-312-darwin.so

Actually your issue looks superficially like the one we have in our CI 
since a few days : https://github.com/OSGeo/gdal/issues/9723 / 
https://github.com/actions/setup-python/issues/849 . Python bindings on 
macos-14 arm64 github were working fine, and suddenly broke at runtime 
with an exception similar to you whereas nobody significant changed 
between working and non-working builds. It looked correlated to some 
update on the github action components, but perhaps that's something 
else. Do you know if there was an operating system update on your system 
recently?

Even

Le 30/04/2024 à 14:51, Andrew Bell via gdal-dev a écrit :
> Hi all,
>
> I removed all files from the build and started over, building using 
> the same procedure that I used with the source from a couple of weeks 
> ago without problem and now I get the following error:
>
> (gdal) [master] $ pytest -v autotest/utilities/test_gdal_viewshed.py
> ImportError while loading conftest 
> '/Users/abell/gdal.2/build/autotest/conftest.py'.
> autotest/conftest.py:9: in <module>
>     from osgeo import gdal, ogr, osr
> swig/python/osgeo/__init__.py:35: in <module>
>     _gdal = swig_import_helper()
> swig/python/osgeo/__init__.py:32: in swig_import_helper
>     return importlib.import_module('_gdal')
> E   ModuleNotFoundError: No module named '_gdal'
>
>
> PYTHONPATH is set as follows:
>
> (gdal) [master] $ env | grep PYTHONPATH
> PYTHONPATH=/Users/abell/gdal.2/build/swig/python:
>
>
> The osgeo directory referenced from PYTHONPATH contains the following:
>
> (gdal) [master] $ ls -l /Users/abell/gdal.2/build/swig/python/osgeo
> total 6136
> -rw-r--r--  1 abell  staff    4758 Apr 30 08:00 __init__.py
> drwxr-xr-x  3 abell  staff      96 Apr 30 08:01 __pycache__
> -rwxr-xr-x  1 abell  staff  970248 Apr 30 08:00 
> _gdal.cpython-312-darwin.so <http://gdal.cpython-312-darwin.so>
> -rwxr-xr-x  1 abell  staff  136376 Apr 30 08:00 
> _gdal_array.cpython-312-darwin.so 
> <http://gdal_array.cpython-312-darwin.so>
> -rwxr-xr-x  1 abell  staff   54352 Apr 30 08:00 
> _gdalconst.cpython-312-darwin.so <http://gdalconst.cpython-312-darwin.so>
> -rwxr-xr-x  1 abell  staff  104072 Apr 30 08:00 
> _gnm.cpython-312-darwin.so <http://gnm.cpython-312-darwin.so>
> -rwxr-xr-x  1 abell  staff  717640 Apr 30 08:00 
> _ogr.cpython-312-darwin.so <http://ogr.cpython-312-darwin.so>
> -rwxr-xr-x  1 abell  staff  416120 Apr 30 08:00 
> _osr.cpython-312-darwin.so <http://osr.cpython-312-darwin.so>
> -rw-r--r--  1 abell  staff  336675 Apr 30 08:00 gdal.py
> -rw-r--r--  1 abell  staff   33746 Apr 30 08:00 gdal_array.py
> -rw-r--r--  1 abell  staff   12517 Apr 30 08:00 gdalconst.py
> -rw-r--r--  1 abell  staff     214 Apr 30 08:00 gdalnumeric.py
> -rw-r--r--  1 abell  staff   14413 Apr 30 08:00 gnm.py
> -rw-r--r--  1 abell  staff  221167 Apr 30 08:00 ogr.py
> -rw-r--r--  1 abell  staff   84266 Apr 30 08:00 osr.py
>
> I would have thought the file _gdal.cpython-312-darwin.so 
> <http://gdal.cpython-312-darwin.so> would have been found and loaded, 
> but my expertise in this is limited. I tried tracing with 
> PYTHONVERBOSE set, but the only references to _gdal I saw were in the 
> same error message quoted above.
>
> Thanks for any help,
>
> On Mon, Apr 29, 2024 at 5:37 PM Even Rouault 
> <even.rouault at spatialys.com> wrote:
>
>     Andrew,
>
>     Perhaps you're running updated GDAL Python bindings against a
>     libgdal that hasn't been rebuilt recently? OSRIsDerivedProjected()
>     has been added recently both in libgdal and the bindings
>
>
> -- 
> Andrew Bell
> andrew.bell.ia at gmail.com
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20240430/d7c6f0d2/attachment-0001.htm>


More information about the gdal-dev mailing list