<div dir="ltr"><div>Hi all,</div><div><br></div><div>I'm trying to create an Anaconda environment to run arosics, a software that performs automatic subpixel co-registration of two satellite image datasets. <br></div><div><br></div><div>The environment seems correctly created, with GDAL working as expected on the CLI:</div><div>
<pre class="gmail-code gmail-highlight" lang="plaintext"><span id="gmail-LC1" class="gmail-line" lang="plaintext">(arosics) PS C:\Users\PedroVenancio> gdalinfo --version</span>
<span id="gmail-LC2" class="gmail-line" lang="plaintext">GDAL 3.3.2, released 2021/09/01</span>
</pre>

 </div><div><br></div><div>The problem is that when Python (versions >=3.8)

 calls GDAL, it gives an error:</div><div>
<pre class="gmail-code gmail-highlight" lang="plaintext"><span id="gmail-LC4" class="gmail-line" lang="plaintext">(arosics) PS C:\Users\PedroVenancio> python</span>
<span id="gmail-LC5" class="gmail-line" lang="plaintext">Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:22:46) [MSC v.1916 64 bit (AMD64)] on win32</span>
<span id="gmail-LC6" class="gmail-line" lang="plaintext">Type "help", "copyright", "credits" or "license" for more information.</span>
<span id="gmail-LC7" class="gmail-line" lang="plaintext"></span>
<span id="gmail-LC8" class="gmail-line" lang="plaintext">>>> from osgeo import gdal</span>
<span id="gmail-LC9" class="gmail-line" lang="plaintext">Traceback (most recent call last):</span>
<span id="gmail-LC10" class="gmail-line" lang="plaintext">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 21, in swig_import_helper</span>
<span id="gmail-LC11" class="gmail-line" lang="plaintext">    return importlib.import_module(mname)</span>
<span id="gmail-LC12" class="gmail-line" lang="plaintext">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", line 127, in import_module</span>
<span id="gmail-LC13" class="gmail-line" lang="plaintext">    return _bootstrap._gcd_import(name[level:], package, level)</span>
<span id="gmail-LC14" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import</span>
<span id="gmail-LC15" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 991, in _find_and_load</span>
<span id="gmail-LC16" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked</span>
<span id="gmail-LC17" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked</span>
<span id="gmail-LC18" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 556, in module_from_spec</span>
<span id="gmail-LC19" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap_external>", line 1166, in create_module</span>
<span id="gmail-LC20" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed</span>
<span id="gmail-LC21" class="gmail-line" lang="plaintext">ImportError: DLL load failed while importing _gdal: Impossível localizar o procedimento especificado.</span>
<span id="gmail-LC22" class="gmail-line" lang="plaintext"></span>
<span id="gmail-LC23" class="gmail-line" lang="plaintext">During handling of the above exception, another exception occurred:</span>
<span id="gmail-LC24" class="gmail-line" lang="plaintext"></span>
<span id="gmail-LC25" class="gmail-line" lang="plaintext">Traceback (most recent call last):</span>
<span id="gmail-LC26" class="gmail-line" lang="plaintext">  File "<stdin>", line 1, in <module></span>
<span id="gmail-LC27" class="gmail-line" lang="plaintext">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 37, in <module></span>
<span id="gmail-LC28" class="gmail-line" lang="plaintext">    _gdal = swig_import_helper()</span>
<span id="gmail-LC29" class="gmail-line" lang="plaintext">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 33, in swig_import_helper</span>
<span id="gmail-LC30" class="gmail-line" lang="plaintext">    raise ImportError(traceback_string + '\n' + msg)</span>
<span id="gmail-LC31" class="gmail-line" lang="plaintext">ImportError: Traceback (most recent call last):</span>
<span id="gmail-LC32" class="gmail-line" lang="plaintext">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 21, in swig_import_helper</span>
<span id="gmail-LC33" class="gmail-line" lang="plaintext">    return importlib.import_module(mname)</span>
<span id="gmail-LC34" class="gmail-line" lang="plaintext">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", line 127, in import_module</span>
<span id="gmail-LC35" class="gmail-line" lang="plaintext">    return _bootstrap._gcd_import(name[level:], package, level)</span>
<span id="gmail-LC36" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import</span>
<span id="gmail-LC37" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 991, in _find_and_load</span>
<span id="gmail-LC38" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked</span>
<span id="gmail-LC39" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked</span>
<span id="gmail-LC40" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 556, in module_from_spec</span>
<span id="gmail-LC41" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap_external>", line 1166, in create_module</span>
<span id="gmail-LC42" class="gmail-line" lang="plaintext">  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed</span>
<span id="gmail-LC43" class="gmail-line" lang="plaintext">ImportError: DLL load failed while importing _gdal: Impossível localizar o procedimento especificado.</span>
<span id="gmail-LC44" class="gmail-line" lang="plaintext"></span>
<span id="gmail-LC45" class="gmail-line" lang="plaintext">On Windows, with Python >= 3.8, DLLs are no longer imported from the PATH.</span>
<span id="gmail-LC46" class="gmail-line" lang="plaintext">If gdalXXX.dll is in the PATH, then set the USE_PATH_FOR_GDAL_PYTHON=YES environment variable</span>
<span id="gmail-LC47" class="gmail-line" lang="plaintext">to feed the PATH into os.add_dll_directory().</span>
</pre>

</div><div>I've reported this error in the arosics issue tracker (<a href="https://git.gfz-potsdam.de/danschef/arosics/-/issues/66">https://git.gfz-potsdam.de/danschef/arosics/-/issues/66</a>), but it seems to be working as expected in some similar systems (windows 10). <br></div><div><br></div><div>So I believe it can be some kind of conflict with other installations on my machine. I've for instance OSGeo4W and everything works fine:</div><div>
<pre class="gmail-code gmail-highlight" lang="plaintext"><span id="gmail-LC2" class="gmail-line" lang="plaintext">C:\OSGeo4W>gdalinfo --version</span>
<span id="gmail-LC3" class="gmail-line" lang="plaintext">GDAL 3.3.1, released 2021/06/28</span>
<span id="gmail-LC4" class="gmail-line" lang="plaintext"></span>
<span id="gmail-LC5" class="gmail-line" lang="plaintext">C:\OSGeo4W>python</span>
<span id="gmail-LC6" class="gmail-line" lang="plaintext">Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32</span>
<span id="gmail-LC7" class="gmail-line" lang="plaintext">Type "help", "copyright", "credits" or "license" for more information.</span>
<span id="gmail-LC8" class="gmail-line" lang="plaintext"></span>
<span id="gmail-LC9" class="gmail-line" lang="plaintext">>>> from osgeo import gdal</span>
<span id="gmail-LC10" class="gmail-line" lang="plaintext">>>> gdal</span>
<span id="gmail-LC11" class="gmail-line" lang="plaintext"><module 'osgeo.gdal' from 'C:\\OSGeo4W\\apps\\Python39\\lib\\site-packages\\osgeo\\gdal.py'></span>
</pre>

</div><div><br></div><div>Has anyone seen this kind of error? Any hints to overcome?</div><div><br></div><div>Thank you very much!</div><div><br></div><div>Best regards,</div><div>Pedro</div><div><br></div></div>