<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0in;
        margin-right:0in;
        margin-bottom:0in;
        margin-left:.5in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.gmail-line
        {mso-style-name:gmail-line;}
span.EmailStyle22
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1636570323;
        mso-list-type:hybrid;
        mso-list-template-ids:1679856350 135659535 135659545 135659547 135659535 135659545 135659547 135659535 135659545 135659547;}
@list l0:level1
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-.25in;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="PT" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language: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.
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language: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.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">I then run a dependency analysis from within the conda shell and found two weird things<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1"><span lang="EN-US" style="mso-fareast-language: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.<o:p></o:p></span></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1"><span lang="EN-US" style="mso-fareast-language: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.”<o:p></o:p></span></li></ol>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Hopefully the screen capture is small enough to get through.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US">Joaquim<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> gdal-dev <gdal-dev-bounces@lists.osgeo.org>
<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 <pedrongvenancio@gmail.com><br>
<b>Cc:</b> gdal-dev@lists.osgeo.org<br>
<b>Subject:</b> Re: [gdal-dev] Running GDAL through Python >= 3.8 on Anaconda - DLL load failed<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></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?<o:p></o:p></p>
<div>
<p class="MsoNormal">Le 13/10/2021 à 15:36, Pedro Venâncio a écrit :<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p>Can you change in __init__.py<o:p></o:p></p>
<p>                try:<br>
                    os.add_dll_directory(p)<br>
                except FileNotFoundError:<br>
                    continue<o:p></o:p></p>
<p><o:p> </o:p></p>
<p>to<o:p></o:p></p>
<p>                try:<br>
                    os.add_dll_directory(p)<br>
                except (FileNotFoundError, OSError):<br>
                    continue<o:p></o:p></p>
</div>
</blockquote>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Yes, here is the output:<o:p></o:p></p>
</div>
<div>
<pre><span class="gmail-line">Traceback (most recent call last):</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 21, in swig_import_helper</span><o:p></o:p></pre>
<pre><span class="gmail-line">    return importlib.import_module(mname)</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", line 127, in import_module</span><o:p></o:p></pre>
<pre><span class="gmail-line">    return _bootstrap._gcd_import(name[level:], package, level)</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "<frozen importlib._bootstrap>", line 991, in _find_and_load</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "<frozen importlib._bootstrap>", line 657, in _load_unlocked</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "<frozen importlib._bootstrap>", line 556, in module_from_spec</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "<frozen importlib._bootstrap_external>", line 1166, in create_module</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed</span><o:p></o:p></pre>
<pre><span class="gmail-line">ImportError: DLL load failed while importing _gdal: Impossível localizar o procedimento especificado.</span><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><span class="gmail-line">During handling of the above exception, another exception occurred:</span><o:p></o:p></pre>
<pre><o:p> </o:p></pre>
<pre><span class="gmail-line">Traceback (most recent call last):</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "demo.py", line 1, in <module></span><o:p></o:p></pre>
<pre><span class="gmail-line">    from osgeo import gdal</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 37, in <module></span><o:p></o:p></pre>
<pre><span class="gmail-line">    _gdal = swig_import_helper()</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\site-packages\osgeo\__init__.py", line 34, in swig_import_helper</span><o:p></o:p></pre>
<pre><span class="gmail-line">    return importlib.import_module('_gdal')</span><o:p></o:p></pre>
<pre><span class="gmail-line">  File "C:\Users\PedroVenancio\anaconda3\envs\arosics\lib\importlib\__init__.py", line 127, in import_module</span><o:p></o:p></pre>
<pre><span class="gmail-line">    return _bootstrap._gcd_import(name[level:], package, level)</span><o:p></o:p></pre>
<pre><span class="gmail-line">ModuleNotFoundError: No module named '_gdal'</span><o:p></o:p></pre>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</blockquote>
<pre>-- <o:p></o:p></pre>
<pre><a href="http://www.spatialys.com">http://www.spatialys.com</a><o:p></o:p></pre>
<pre>My software is free, but my time generally not.<o:p></o:p></pre>
</div>
</body>
</html>