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

Pedro Venâncio pedrongvenancio at gmail.com
Wed Oct 13 06:20:05 PDT 2021


> But I don't understand why you still get the "On Windows, with Python >=
> 3.8, DLLs are no longer imported from the PATH." error message.
>
> It shouldn't be emitted because USE_PATH_FOR_GDAL_PYTHON is set:
> https://github.com/OSGeo/gdal/blob/f3a83a2c2628219bdc60001580da677758015a60/gdal/swig/python/osgeo/__init__.py#L25
>
> Something weird happening here. Perhaps edit
> https://github.com/OSGeo/gdal/blob/f3a83a2c2628219bdc60001580da677758015a60/gdal/swig/python/osgeo/__init__.py#L25
> to display os.environ
>

Even, I was not setting the environment variable correctly on conda. It
needs to be

conda env config vars set USE_PATH_FOR_GDAL_PYTHON=YES

and then I already get

conda env config vars listUSE_PATH_FOR_GDAL_PYTHON = YES

So, the error message had changed

python demo.pyTraceback (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 11, in <module>    os.add_dll_directory(p)  File
"C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\os.py", line 1109,
in add_dll_directory    cookie = nt._add_dll_directory(path)OSError:
[WinError 87] O parâmetro está incorreto: '.'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211013/64f85839/attachment.html>


More information about the gdal-dev mailing list