<div dir="ltr"><div>Hi Joaquim,</div><div><br></div><div>Thanks for sharing your case. Did you manage to make it work in some way?</div><div><br></div><div>I've already uninstalled a test PostgreSQL/PostGIS that I supposed to be the source of the conflict, but I keep having the same error. <br></div><div><br></div><div>I also reinstalled conda, but nothing had changed.</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Joaquim Manuel Freire Luís <<a href="mailto:jluis@ualg.pt">jluis@ualg.pt</a>> escreveu no dia quarta, 13/10/2021 à(s) 15:24:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div style="overflow-wrap: break-word;" lang="PT">
<div class="gmail-m_-5393199779902282863WordSection1">
<p class="MsoNormal"><span>Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I have a certain horror to python (that I’m trying to fight) a bit of it is because I never manage to really use it.
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I had and older Miniconda (Mini => 18 GB !!!!) that was so big that I removed and installed a new one in which I tried Pedro’s case and got exactly the same errors.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I then run a dependency analysis from within the conda shell and found two weird things<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<ol style="margin-top:0in" type="1" start="1">
<li class="gmail-m_-5393199779902282863MsoListParagraph" style="margin-left:0in"><span lang="EN-US">The gdal dll depends on a xerces-c_3_2.dll locate at C:\WINDOWS\system32. This seems quite dangerous (for dependency sakes) but
seems to not cause any problem in this case.<u></u><u></u></span></li><li class="gmail-m_-5393199779902282863MsoListParagraph" style="margin-left:0in"><span lang="EN-US">There is a “red mark” on the opj_encoder_set_extra_options symbol and this alone can explain the “ImportError: DLL load failed
while importing _gdal: The specified procedure could not be found.”<u></u><u></u></span></li></ol>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Hopefully the screen capture is small enough to get through.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Joaquim<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<div style="border-color:rgb(225,225,225) currentcolor currentcolor;border-style:solid none none;border-width:1pt medium medium;padding:3pt 0in 0in">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> gdal-dev <<a href="mailto:gdal-dev-bounces@lists.osgeo.org" target="_blank">gdal-dev-bounces@lists.osgeo.org</a>>
<b>On Behalf Of </b>Even Rouault<br>
<b>Sent:</b> Wednesday, October 13, 2021 2:39 PM<br>
<b>To:</b> Pedro Venâncio <<a href="mailto:pedrongvenancio@gmail.com" target="_blank">pedrongvenancio@gmail.com</a>><br>
<b>Cc:</b> <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<b>Subject:</b> Re: [gdal-dev] Running GDAL through Python >= 3.8 on Anaconda - DLL load failed<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p>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?<u></u><u></u></p>
<div>
<p class="MsoNormal">Le 13/10/2021 à 15:36, Pedro Venâncio a écrit :<u></u><u></u></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<blockquote style="border-color:currentcolor currentcolor currentcolor rgb(204,204,204);border-style:none none none solid;border-width:medium medium medium 1pt;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<p>Can you change in __init__.py<u></u><u></u></p>
<p> try:<br>
os.add_dll_directory(p)<br>
except FileNotFoundError:<br>
continue<u></u><u></u></p>
<p><u></u> <u></u></p>
<p>to<u></u><u></u></p>
<p> try:<br>
os.add_dll_directory(p)<br>
except (FileNotFoundError, OSError):<br>
continue<u></u><u></u></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Yes, here is the output:<u></u><u></u></p>
</div>
<div>
<pre><span class="gmail-m_-5393199779902282863gmail-line">Traceback (most recent call last):</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 21, in swig_import_helper</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> return importlib.import_module(mname)</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", line 127, in import_module</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> return _bootstrap._gcd_import(name[level:], package, level)</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "<frozen importlib._bootstrap>", line 1014, in _gcd_import</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "<frozen importlib._bootstrap>", line 991, in _find_and_load</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "<frozen importlib._bootstrap>", line 657, in _load_unlocked</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "<frozen importlib._bootstrap>", line 556, in module_from_spec</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "<frozen importlib._bootstrap_external>", line 1166, in create_module</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line">ImportError: DLL load failed while importing _gdal: Impossível localizar o procedimento especificado.</span><u></u><u></u></pre>
<pre><u></u> <u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line">During handling of the above exception, another exception occurred:</span><u></u><u></u></pre>
<pre><u></u> <u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line">Traceback (most recent call last):</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "demo.py", line 1, in <module></span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> from osgeo import gdal</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 37, in <module></span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> _gdal = swig_import_helper()</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 34, in swig_import_helper</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> return importlib.import_module('_gdal')</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", line 127, in import_module</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line"> return _bootstrap._gcd_import(name[level:], package, level)</span><u></u><u></u></pre>
<pre><span class="gmail-m_-5393199779902282863gmail-line">ModuleNotFoundError: No module named '_gdal'</span><u></u><u></u></pre>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
</blockquote>
<pre>-- <u></u><u></u></pre>
<pre><a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a><u></u><u></u></pre>
<pre>My software is free, but my time generally not.<u></u><u></u></pre>
</div>
</div>
</blockquote></div>