[gdal-dev] Running GDAL through Python >= 3.8 on Anaconda - DLL load failed

Even Rouault even.rouault at spatialys.com
Wed Oct 13 06:39:14 PDT 2021


ok, so now you have to inspect the PATH and fix it so that the gdal DLL 
and its dependencies are in it. But all of this sounds like there's 
something weird in your environment. Perhaps a mix of GDAL versions?

Le 13/10/2021 à 15:36, Pedro Venâncio a écrit :
>
>     Can you change in __init__.py
>
>                     try:
>                         os.add_dll_directory(p)
>                     except FileNotFoundError:
>                         continue
>
>
>     to
>
>                     try:
>                         os.add_dll_directory(p)
>                     except (FileNotFoundError, OSError):
>                         continue
>
>
> Yes, here is the output:
> Traceback (most recent call last):
> File 
> "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", 
> line 21, in swig_import_helper
> return importlib.import_module(mname)
> File 
> "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", 
> line 127, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
> File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
> File "<frozen importlib._bootstrap>", line 991, in _find_and_load
> File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
> File "<frozen importlib._bootstrap>", line 657, in _load_unlocked
> File "<frozen importlib._bootstrap>", line 556, in module_from_spec
> File "<frozen importlib._bootstrap_external>", line 1166, in create_module
> File "<frozen importlib._bootstrap>", line 219, in 
> _call_with_frames_removed
> ImportError: DLL load failed while importing _gdal: Impossível 
> localizar o procedimento especificado.
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File "demo.py", line 1, in <module>
> from osgeo import gdal
> File 
> "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", 
> line 37, in <module>
> _gdal = swig_import_helper()
> File 
> "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", 
> line 34, in swig_import_helper
> return importlib.import_module('_gdal')
> File 
> "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", 
> line 127, in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
> ModuleNotFoundError: No module named '_gdal'
>
-- 
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/20211013/19ccbff1/attachment-0001.html>


More information about the gdal-dev mailing list