oracle / python-cx_Oracle

Python interface to Oracle Database now superseded by python-oracledb
https://oracle.github.io/python-cx_Oracle
Other
888 stars 361 forks source link

DPI-1047: 64-bit Oracle Client library cannot be loaded #84

Closed wrdaigle closed 7 years ago

wrdaigle commented 7 years ago

I'm beating my head against a wall on this one. Here is the synopsis. I have an ArcGIS server running on a Linux box. The ArcGIS server software install include a custom version of WINE, with python running under wine. We are tyring to run cx_Oracle within the version of Python running under WINE. We got this working in a previous version ArcGIS server, bu so far no luck with the latest version.

Answer the following questions:

  1. What is your version of Python? Is it 32-bit or 64-bit? Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32 -running under WINE v1.9.2-1051final

  2. What is your version of cx_Oracle? 6.0.2

  3. What is your version of the Oracle client (e.g. Instant Client)? How was it installed? Where is it installed? 11.2.0.4 instant client - 64-bit windows version

  4. What is your version of the Oracle Database? 11.2.0.4

  5. What is your OS and version? Ubuntu 16.04.3 running 64-bit version of WINE

  6. What compiler version did you use? For example, with GCC, run gcc --version. gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

  7. What environment variables did you set? How exactly did you set them? wine regedit HKLM>SYSTEM.CurrentControlSet>Control>Session Manager>Environment

    • added oracle instant client path to the PATH variable as I would on a windows machine
  8. What exact command caused the problem (e.g. what command did you try to install with)? Who were you logged in as? The lbrary imports fine. When I tried to create a connect: c = cx_Oracle.connect('tnsname','un','pw') or try to check the client version: cx_Oracle.clientversion() I get the following error:

Traceback (most recent call last): File "", line 1, in cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "DLL initialization failed". See https://oracle.github.io/odpi/doc/installation.html#windows for help

cjbj commented 7 years ago

I imagine you still need the VS Redistributable in this environment? Per the Instant Client download page , Oracle 11.2 needs the Microsoft Visual Studio 2005 Redistributable.

wrdaigle commented 7 years ago

I have tried installing it under wine without success. However, I'm not sure this is the problem since I can successfully use the client via sqlplus (running under WINE).

cjbj commented 7 years ago

If you can run SQL*Plus, it seems logical that you'd be able to invoke other OCI programs like cx_Oracle - but you are definitely in unsupported explorer territory.

wrdaigle commented 7 years ago

Indeed. I was really hoping to find a solution to this. Since we had it working in an earlier version, I'm facing a relatively hefty rewrite in order to maintain the same functionality

cjbj commented 7 years ago

It would be interesting to know if cx_Oracle 5.3 works: http://cx-oracle.readthedocs.io/en/v5.x/installation.html

wrdaigle commented 7 years ago

I wish I could tell you. The previous version of CX Oracle we were using was 5.2 something,a nd that worked fine. I tried 5.3, but it has a requirement for visual C++ for python, and for the life of me I couldn't get that to install on wine.


From: Christopher Jones [notifications@github.com] Sent: Friday, September 22, 2017 5:17 PM To: oracle/python-cx_Oracle Cc: Daigle, Bill; Author Subject: Re: [oracle/python-cx_Oracle] DPI-1047: 64-bit Oracle Client library cannot be loaded (#84)

It would be interesting to know if cx_Oracle 5.3 works: http://cx-oracle.readthedocs.io/en/v5.x/installation.html

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/oracle/python-cx_Oracle/issues/84#issuecomment-331581286, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA-HTo_Q6s9dODhcUXGgKCBmxgLAebRUks5slD_1gaJpZM4PhCCD.

cjbj commented 7 years ago

Did you try the Windows EXE from https://pypi.python.org/pypi/cx_Oracle/5.3 ?

Can you clarify whether you have any cx_Oracle version running with your current ArcGIS setup?

Triple check your PATH etc.

wrdaigle commented 7 years ago

Good thought. I just tried the exe. It seems to have installed successfully, but I try to import it, I get a “DLL initialization failed.” error.

All version of cx_Oracle work fine with my desktop installs ArcGIS. The problem only exist once we get to server.

I think the root of the problem is the lack of the .NET framework with WINE on our latest server. The previous version had several versions included (4.0, 3.0, 2.0 and 1.1) packaged with wine. We are working on getting .NET onto the our new version to see if that makes a difference.

From: Christopher Jones [mailto:notifications@github.com] Sent: Monday, September 25, 2017 11:19 AM To: oracle/python-cx_Oracle python-cx_Oracle@noreply.github.com Cc: Daigle, Bill BDaigle@mt.gov; Author author@noreply.github.com Subject: Re: [oracle/python-cx_Oracle] DPI-1047: 64-bit Oracle Client library cannot be loaded (#84)

Did you try the Windows EXE from https://pypi.python.org/pypi/cx_Oracle/5.3 ?

Can you clarify whether you have any cx_Oracle version running with your current ArcGIS setup?

Triple check your PATH etc.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/oracle/python-cx_Oracle/issues/84#issuecomment-331950840, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AA-HTt4vTjtQpRMUfptU2MHUFDZuEuADks5sl-CdgaJpZM4PhCCD.

cjbj commented 7 years ago

It's still puzzling that SQL*Plus works but cx_Oracle doesn't - they rely on pretty much the same things.

wrdaigle commented 7 years ago

Ultimately, we end up finding a solution. It's not pretty, but it works. Instead of installing anything within wine itself, we installed everything on dedicated 64-bit Windows desktop and copied the compiled files over to the WINE installation on the linux server.

We copied the following to the site-packages directory on the ArcGIS server: -cx_oracle.pyd -the oracle instant client dlls Placing the windows dlls in this directory allowed cx_Oracle to function without updating the path variables associated with the linux version of the client (which is used by other aspects of the ArcGIS software)

Additionally, we copied the Microsoft Framework folder (C:\Windows\Microsoft.NET\Framework).

With this method, we were able to get the 5.x versions of cx_Oracle to function. Still no luck with 6.x, but we can live without that for now.

Thanks for the help!