Re: Using cx_Oracle 6.0rc1 on Windows

Anthony Tuininga <[email protected]> Thu, 6 Jul 2017 11:11:48 -0600
Newsgroups gmane.comp.python.db.cx-oracle
Message-ID <CAE1XR-4nfvCO7K9+V_y4w=V9+9o5VFBebBEKAhdbbWt6iw4HCg@mail.gmail.com>
--===============5385938982074612230==
Content-Type: multipart/alternative; boundary="089e0822ed5c5283700553a9362a"

--089e0822ed5c5283700553a9362a
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Jul 6, 2017 at 9:48 AM, Walter D=C3=B6rwald <[email protected]>
wrote:

> On 6 Jul 2017, at 0:45, Anthony Tuininga wrote:
>
> On Wed, Jul 5, 2017 at 4:12 PM, Anthony Tuininga <
>> [email protected]
>>
>>> wrote:
>>>
>>
>> [...]
>>> I have discovered the source of the problem. I was able to replicate th=
e
>>> issue thanks to this pointer and have corrected it in the source. If yo=
u
>>> can do a new pull and compile you should get the correct error message
>>> now.
>>> If you can confirm that would be helpful! Thanks.
>>>
>>>
>> Just to be clear since the process is a bit different now: in your
>> cx_Oracle repository you need to issue the following commands:
>>
>> git pull
>> git submodule update
>>
>
> "git submodule update" doesn't seem to do anything. Do we need a special
> git configuration for that?
>

No. But if you didn't initialise the submodule when you first cloned
cx_Oracle that would happen. The correct steps for initial cloning is as
follows:

git clone https://github.com/oracle/python-cx_Oracle.git cx_Oracle
cd cx_Oracle
git submodule init


> Making odpi empty and doing "git clone https://github.com/oracle/odpi"
> helps.


The submodule is used so that you get the right version of ODPI-C. Right
now there aren't any incompatible changes in ODPI-C but that will change in
the future. So you don't want to do this long-term!


>
>
> That will update ODPI-C (where the correction was made) as well as
>> cx_Oracle itself.
>>
>
> With this (and a python -v), we do indeed get the following:
>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "<frozen importlib._bootstrap>", line 961, in _find_and_load
>   File "<frozen importlib._bootstrap>", line 950, in
> _find_and_load_unlocked
>   File "<frozen importlib._bootstrap>", line 648, in _load_unlocked
>   File "<frozen importlib._bootstrap>", line 560, in module_from_spec
>   File "<frozen importlib._bootstrap_external>", line 922, in
> create_module
>   File "<frozen importlib._bootstrap>", line 205, in
> _call_with_frames_removed
> cx_Oracle.DatabaseError: DPI-1047: Oracle Client library cannot be loaded=
:
> %1 ist keine zul=C3=A4ssige Win32-Anwendung. See https://oracle.github.io=
/odpi/
> doc/installation.html for help
>

Excellent. Thanks for confirming.


>
> [...]
>>>>> And of cause it would help if %1 was resolved to a useful filename.
>>>>>
>>>>
>>>> Naturally. But that information isn't directly provided. I'll look int=
o
>>>> that, too.
>>>>
>>>
>>> This is a limitation of Windows and there isn't much that can be done
>>> about it. Sorry!
>>>
>>
> May be the %1 is supposed to be the argument that was passed to
> LoadLibrary()?
>

I believe it is supposed to refer to the *actual* DLL that caused the
problem -- but as far as I know there isn't a way to get this value. The
value passed to LoadLibrary() is simply "oci.dll" so that doesn't help
much. The installation documentation linked to in the error message gives
you that much!


>
> According to the documentation of FormatMessageW() at
>
>    https://msdn.microsoft.com/en-us/library/windows/desktop/
> ms679351(v=3Dvs.85).aspx
>
> it should by possible to pass in arguments to FormatMessageW() in the las=
t
> parameter.
>

Yes, it does.

>
> At least this would mean that the user gets to see the path to the
> cx_Oracle DLL.
>

But how does one get that information? As far as I know there isn't a way
to get it. See the comments here:
https://stackoverflow.com/questions/6190105/formatmessage-with-placeholders=
.


>
> Of course it would be better, if we could see which DLL ultimately is the
> problem.
>

Definitely! Too bad Microsoft doesn't provide that information. :-(


>
> But now for the real error...
>>>>>
>>>>> [...]
>>>>>
>>>>>>
>>>>>> You can use this tool: http://www.dependencywalker.com/ which will
>>>>>> tell you
>>>>>> what dependencies the cx_Oracle.pyd file and all of their
>>>>>> dependencies,
>>>>>> too. Hopefully it helps.
>>>>>>
>>>>>>
>>>>> OK, we tried that. The output is here:
>>>>>
>>>>>    http://styx.livinglogic.de/~walter/cx_Oracle/cx_Oracle.cp36
>>>>> -win_amd64.txt
>>>>>
>>>>> dependencywalker seem that have many problems with this DLL, but what
>>>>> sticks out is VCRUNTIME140.dll. This seems to be part of the "Visual
>>>>> C++
>>>>> Redistributable for Visual Studio 2015" which we downloaded from here=
:
>>>>>
>>>>>    https://www.microsoft.com/en-us/download/details.aspx?id=3D48145
>>>>>
>>>>> (we've downloaded vc_redist.x64.exe). When we install it, it complain=
s
>>>>> that another version is already installed. After we've uninstalled th=
e
>>>>> 2017
>>>>> Redistributables installation works, but the output of "import
>>>>> cx_Oracle"
>>>>> remains the same.
>>>>>
>>>>>
>>>> So the problem isn't resolved by the change of VS redistributable. Can
>>>> you take a look in the event log? Can you also provide a list of all o=
f
>>>> the
>>>> VS redistributables you have installed? I am going to try to replicate
>>>> this
>>>> myself.
>>>>
>>>
> OK, the list is here:
>
>    http://styx.livinglogic.de/~walter/cx_Oracle/VCRedistributables.png
>
>
Thanks. I have downloaded VS 2017 and will attempt to build with it. I know
that Python itself was built with VS 2015 so that redistributable will be
needed but the 2017 one will also probably be needed. I'll let you know if
I am able to replicate your issue.


>
> [...]
>>
>
> Servus,
>    Walter
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> cx-oracle-users mailing list
> cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>

--089e0822ed5c5283700553a9362a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
hu, Jul 6, 2017 at 9:48 AM, Walter D=C3=B6rwald <span dir=3D"ltr">&lt;<a hr=
ef=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin=
:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"=
><span class=3D"gmail-">On 6 Jul 2017, at 0:45, Anthony Tuininga wrote:<br>
<br>
</span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=3D"gma=
il-">
On Wed, Jul 5, 2017 at 4:12 PM, Anthony Tuininga &lt;<a href=3D"mailto:anth=
[email protected]" target=3D"_blank">[email protected]</a><br=
>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">
wrote:<br>
</blockquote>
<br>
</span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex">
[...]<span class=3D"gmail-"><br>
I have discovered the source of the problem. I was able to replicate the<br=
>
issue thanks to this pointer and have corrected it in the source. If you<br=
>
can do a new pull and compile you should get the correct error message now.=
<br>
If you can confirm that would be helpful! Thanks.<br>
<br>
</span></blockquote><span class=3D"gmail-">
<br>
Just to be clear since the process is a bit different now: in your<br>
cx_Oracle repository you need to issue the following commands:<br>
<br>
git pull<br>
git submodule update<br>
</span></blockquote>
<br>
&quot;git submodule update&quot; doesn&#39;t seem to do anything. Do we nee=
d a special git configuration for that?<br></blockquote><div><br></div><div=
>No. But if you didn&#39;t initialise the submodule when you first cloned c=
x_Oracle that would happen. The correct steps for initial cloning is as fol=
lows:</div><div><br></div><div>git clone=C2=A0<a href=3D"https://github.com=
/oracle/python-cx_Oracle.git">https://github.com/oracle/python-cx_Oracle.gi=
t</a> cx_Oracle</div><div>cd cx_Oracle</div><div>git submodule init</div><d=
iv><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px =
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Making odpi empty and doing &quot;git clone <a href=3D"https://github.com/o=
racle/odpi" rel=3D"noreferrer" target=3D"_blank">https://github.com/oracle/=
odpi</a><wbr>&quot; helps.</blockquote><div><br></div><div>The submodule is=
 used so that you get the right version of ODPI-C. Right now there aren&#39=
;t any incompatible changes in ODPI-C but that will change in the future. S=
o you don&#39;t want to do this long-term!</div><div>=C2=A0</div><blockquot=
e class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px s=
olid rgb(204,204,204);padding-left:1ex"><span class=3D"gmail-"><br>
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">
That will update ODPI-C (where the correction was made) as well as<br>
cx_Oracle itself.<br>
</blockquote>
<br></span>
With this (and a python -v), we do indeed get the following:<span class=3D"=
gmail-"><br>
<br>
Traceback (most recent call last):<br>
=C2=A0 File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;<br>
=C2=A0 File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 961, in _=
find_and_load<br>
=C2=A0 File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 950, in _=
find_and_load_unlocked<br>
=C2=A0 File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 648, in _=
load_unlocked<br>
=C2=A0 File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 560, in m=
odule_from_spec<br>
=C2=A0 File &quot;&lt;frozen importlib._bootstrap_external&gt;<wbr>&quot;, =
line 922, in create_module<br>
=C2=A0 File &quot;&lt;frozen importlib._bootstrap&gt;&quot;, line 205, in _=
call_with_frames_removed<br></span>
cx_Oracle.DatabaseError: DPI-1047: Oracle Client library cannot be loaded: =
%1 ist keine zul=C3=A4ssige Win32-Anwendung. See <a href=3D"https://oracle.=
github.io/odpi/doc/installation.html" rel=3D"noreferrer" target=3D"_blank">=
https://oracle.github.io/odpi/<wbr>doc/installation.html</a> for help<br></=
blockquote><div><br></div><div>Excellent. Thanks for confirming.</div><div>=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0=
.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex"><blockquote class=3D"gmail_quote" style=3D"margin:=
0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">
[...]<span class=3D"gmail-"><br>
And of cause it would help if %1 was resolved to a useful filename.<br>
</span></blockquote><span class=3D"gmail-">
<br>
Naturally. But that information isn&#39;t directly provided. I&#39;ll look =
into<br>
that, too.<br>
</span></blockquote><span class=3D"gmail-">
<br>
This is a limitation of Windows and there isn&#39;t much that can be done<b=
r>
about it. Sorry!<br>
</span></blockquote></blockquote>
<br>
May be the %1 is supposed to be the argument that was passed to LoadLibrary=
()?<br></blockquote><div><br></div><div>I believe it is supposed to refer t=
o the *actual* DLL that caused the problem -- but as far as I know there is=
n&#39;t a way to get this value. The value passed to LoadLibrary() is simpl=
y &quot;oci.dll&quot; so that doesn&#39;t help much. The installation docum=
entation linked to in the error message gives you that much!</div><div>=C2=
=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
According to the documentation of FormatMessageW() at<br>
<br>
=C2=A0 =C2=A0<a href=3D"https://msdn.microsoft.com/en-us/library/windows/de=
sktop/ms679351(v=3Dvs.85).aspx" rel=3D"noreferrer" target=3D"_blank">https:=
//msdn.microsoft.com/<wbr>en-us/library/windows/desktop/<wbr>ms679351(v=3Dv=
s.85).aspx</a><br>
<br>
it should by possible to pass in arguments to FormatMessageW() in the last =
parameter.<br></blockquote><div><br></div><div>Yes, it does.=C2=A0</div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex">
<br>
At least this would mean that the user gets to see the path to the cx_Oracl=
e DLL.<br></blockquote><div><br></div><div>But how does one get that inform=
ation? As far as I know there isn&#39;t a way to get it. See the comments h=
ere:=C2=A0<a href=3D"https://stackoverflow.com/questions/6190105/formatmess=
age-with-placeholders">https://stackoverflow.com/questions/6190105/formatme=
ssage-with-placeholders</a>.</div><div>=C2=A0</div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex">
<br>
Of course it would be better, if we could see which DLL ultimately is the p=
roblem.<br></blockquote><div><br></div><div>Definitely! Too bad Microsoft d=
oesn&#39;t provide that information. :-(</div><div>=C2=A0</div><blockquote =
class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px sol=
id rgb(204,204,204);padding-left:1ex">
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><blockquote class=3D"gmai=
l_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,20=
4,204);padding-left:1ex"><blockquote class=3D"gmail_quote" style=3D"margin:=
0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">=
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><span class=3D"gmail-">
But now for the real error...<br>
<br>
[...]<br>
</span><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br><span class=3D"gmail-">
You can use this tool: <a href=3D"http://www.dependencywalker.com/" rel=3D"=
noreferrer" target=3D"_blank">http://www.dependencywalker.co<wbr>m/</a> whi=
ch will<br>
tell you<br>
what dependencies the cx_Oracle.pyd file and all of their dependencies,<br>
too. Hopefully it helps.<br>
<br>
</span></blockquote><span class=3D"gmail-">
<br>
OK, we tried that. The output is here:<br>
<br>
=C2=A0 =C2=A0<a href=3D"http://styx.livinglogic.de/~walter/cx_Oracle/cx_Ora=
cle.cp36" rel=3D"noreferrer" target=3D"_blank">http://styx.livinglogic.de/~=
w<wbr>alter/cx_Oracle/cx_Oracle.cp36</a><br>
-win_amd64.txt<br>
<br>
dependencywalker seem that have many problems with this DLL, but what<br>
sticks out is VCRUNTIME140.dll. This seems to be part of the &quot;Visual C=
++<br>
Redistributable for Visual Studio 2015&quot; which we downloaded from here:=
<br>
<br>
=C2=A0 =C2=A0<a href=3D"https://www.microsoft.com/en-us/download/details.as=
px?id=3D48145" rel=3D"noreferrer" target=3D"_blank">https://www.microsoft.c=
om/en-<wbr>us/download/details.aspx?id=3D48<wbr>145</a><br>
<br>
(we&#39;ve downloaded vc_redist.x64.exe). When we install it, it complains<=
br>
that another version is already installed. After we&#39;ve uninstalled the =
2017<br>
Redistributables installation works, but the output of &quot;import cx_Orac=
le&quot;<br>
remains the same.<br>
<br>
</span></blockquote><span class=3D"gmail-">
<br>
So the problem isn&#39;t resolved by the change of VS redistributable. Can<=
br>
you take a look in the event log? Can you also provide a list of all of the=
<br>
VS redistributables you have installed? I am going to try to replicate this=
<br>
myself.<br>
</span></blockquote></blockquote></blockquote>
<br>
OK, the list is here:<br>
<br>
=C2=A0 =C2=A0<a href=3D"http://styx.livinglogic.de/~walter/cx_Oracle/VCRedi=
stributables.png" rel=3D"noreferrer" target=3D"_blank">http://styx.livinglo=
gic.de/~w<wbr>alter/cx_Oracle/VCRedistributa<wbr>bles.png</a><div class=3D"=
gmail-HOEnZb"><div class=3D"gmail-h5"><br></div></div></blockquote><div><br=
></div><div>Thanks. I have downloaded VS 2017 and will attempt to build wit=
h it. I know that Python itself was built with VS 2015 so that redistributa=
ble will be needed but the 2017 one will also probably be needed. I&#39;ll =
let you know if I am able to replicate your issue.</div><div>=C2=A0</div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft:1px solid rgb(204,204,204);padding-left:1ex"><div class=3D"gmail-HOEnZb"=
><div class=3D"gmail-h5">
<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex">
[...]<br>
</blockquote>
<br>
Servus,<br>
=C2=A0 =C2=A0Walter<br>
<br>
------------------------------<wbr>------------------------------<wbr>-----=
-------------<br>
Check out the vibrant tech community on one of the world&#39;s most<br>
engaging tech sites, Slashdot.org! <a href=3D"http://sdm.link/slashdot" rel=
=3D"noreferrer" target=3D"_blank">http://sdm.link/slashdot</a><br>
______________________________<wbr>_________________<br>
cx-oracle-users mailing list<br>
<a href=3D"mailto:cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org" target=3D"_blank">=
[email protected]<wbr>rge.net</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/cx-oracle-users" re=
l=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/<wbr>lists=
/listinfo/cx-oracle-users</a><br>
</div></div></blockquote></div><br></div></div>

--089e0822ed5c5283700553a9362a--


--===============5385938982074612230==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
--===============5385938982074612230==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
cx-oracle-users mailing list
cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/cx-oracle-users

--===============5385938982074612230==--