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: Cannot locate a 64-bit Oracle Client library #319

Closed edelgadocru closed 5 years ago

edelgadocru commented 5 years ago

Delete unnecessary parts of this template.

For security issues:

See https://www.oracle.com/support/assurance/vulnerability-remediation/reporting-security-vulnerabilities.html for how to report security issues.

For general questions:

Describe exactly what you did and what you want to happen. Use the questions at the bottom of this template as a guide.

Use Markdown syntax, particularly for code blocks: see https://help.github.com/articles/basic-writing-and-formatting-syntax/#quoting-code

For installation issues:

Use a gist for screen output and logs: see https://gist.github.com/ Do not paste long output into this issue

Review your output and logs. Google any errors Try to install in a different way. Try some potential solutions.

Review the install instructions at http://cx-oracle.readthedocs.io/en/latest/installation.html

Answer the following questions:

  1. What is your version of Python? Is it 32-bit or 64-bit? --> Python 3.7.3 (tags/v3.7.3:ef4ec6ed12, Mar 25 2019, 22:05:12) [MSC v.1916 64 bit (AMD64)] on win32

  2. What is your cx_Oracle version? --> cx-oracle-7.1.3

  3. What exact command caused the problem (e.g. what command did you try to install with)? Who were you logged in as? -->con = cx_Oracle.connect('USER/pass@host:port/SID')

  4. What error(s) you are seeing?

  5. What OS (and version) is Python executing on?

  6. What is your version of the Oracle client (e.g. Instant Client)? How was it installed? Where is it installed? --> cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help

  7. What is your Oracle Database version? --> Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

  8. What is the PATH environment variable (on Windows) or LD_LIBRARY_PATH (on Linux) set to? On macOS, what is in ~/lib? -> C:\Oracle\instantclient_18_5\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\A123846\AppData\Local\Microsoft\WindowsApps;;C:\Users\A123846\AppData\Local\Programs\Microsoft VS Code\bin

  9. What Oracle environment variables did you set? How exactly did you set them? oracle_home --> C:\Oracle\instantclient_18_5\

  10. Do you have a small, single Python script that immediately runs to show us the problem?

import cx_Oracle import os import sys

print(sys.version)

print(os.environ['ORACLE_HOME'])

print(os.environ['path'])

con = cx_Oracle.connect('USER/pass@host:port/SID') print (con.version)

con.close()

cjbj commented 5 years ago
edelgadocru commented 5 years ago

I've installed instantclient-basic-windows.x64-18.5.0.0.0dbru.zip i've restart all terminals and windows after setting path. I've installed Microsoft Visual C++ 2013 Resdistibutable (x64) - 12.0.40664

edelgadocru commented 5 years ago

I've installed instantclient-basic-windows.x64-18.5.0.0.0dbru.zip i've restart all terminals and windows after setting path. I've installed Microsoft Visual C++ 2013 Resdistibutable (x64) - 12.0.40664

anthony-tuininga commented 5 years ago

A few notes that may be of help:

import os
import platform

LOCATION = r"C:\Oracle\instantclient_18_5"
print("ARCH:", platform.architecture())
print("FILES AT LOCATION:")
for name in os.listdir(LOCATION):
    print(name)
os.environ["PATH"] = LOCATION + ";" + os.environ["PATH"]

import cx_Oracle
conn = cx_Oracle.connect("USER/pass@server/SERVICE")

Please show the output of this script. You should see OCI.DLL listed in the output The architecture should indicate that it is 64-bit.

edelgadocru commented 5 years ago

ARCH: ('64bit', 'WindowsPE') FILES AT LOCATION: adrci.exe adrci.sym BASIC_LICENSE BASIC_README bin genezi.exe genezi.sym glogin.sql oci.dll oci.sym ocijdbc18.dll ocijdbc18.sym ociw32.dll ociw32.sym ojdbc8.jar oramysql18.dll oramysql18.sym orannzsbb18.dll orannzsbb18.sym oraocci18.dll oraocci18.sym oraocci18d.dll oraocci18d.sym oraociei18.dll oraociei18.sym oraons.dll orasql18.dll orasql18.sym orasqlplusic18.dll sqlplus.exe sqlplus.sym SQLPLUS_LICENSE SQLPLUS_README uidrvci.exe uidrvci.sym vc14 xstreams.jar Traceback (most recent call last): File "pruebaCX.py", line 13, in conn = cx_Oracle.connect("USER/pass@server/SERVICE") cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "The specified module could not be found". See https://oracle.github.io/odpi/doc/installation.html#windows for help

anthony-tuininga commented 5 years ago

So, now all you need to do is verify that you actually have a 64-bit instant client at that location. It would seem that you don't, or one of the dependencies that it requires is missing. This Stack Overflow question should help you figure that out. DependencyWalker should let you know about any missing dependencies.

anthony-tuininga commented 5 years ago

Did you get this resolved?

cjbj commented 5 years ago

Closing - no activity.

santosh-Plsql commented 5 years ago

Thank you anthony... I faced similiar issue and it got resolved by changing environ path in python

omrumcetin commented 4 years ago

@santosh-Plsql you changed from what to what, could you please be more specific? I got same error.

santosh-Plsql commented 4 years ago

I python code os.environ["PATH"]=location where instant client is available.

oguzhannkayaa commented 4 years ago

@santosh-Plsql please can you be more specific. I am having same error what did you do to fix it? hope write back

oguzhannkayaa commented 4 years ago

@santosh-Plsql what did you do the new environment path?

pedromoraisf commented 4 years ago

I am having same error what did you do to fix it??????? please

cjbj commented 4 years ago

@oguzhan10 @pedromoraisf details matter, so open new issues with LOTS of detail about what is installed and how it was installed.

skrishnabharat commented 4 years ago

Can you help me with this similar error.

cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "/lib64/libc.so.6: version `GLIBC_2.14' not found (required by /ngs/app/alect/pythonApps/instantclient_19_3/libclntsh.so)".

cjbj commented 4 years ago

@skrishnabharat please open new issues for new problems. This issue is closed (PS. your answer is use 18c or upgrade Linux)

fouadtahiri commented 3 years ago

I solved it with cx_Oracle.init_oracle_client("path_to_folder_instantclient_19_8") connection = cx_Oracle.connect("SYSTEM", "Oradoc_db1", "localhost/ORCLCDB.localdomain")

using python3 64bit, _instantclient_19_8 64bit and latest cx_Oracle version for python3.

cjbj commented 3 years ago

In general, see cx_Oracle 8 Initialization for the documentation on how to tell cx_Oracle where the Oracle client libraries are located.

cjbj commented 1 year ago

For readers coming via Google: the simplest solution for most people will be to upgrade to the latest version of cx_Oracle, now called python-oracledb, see the release announcement. The default 'Thin' mode doesn't use Oracle Client libraries so you will never get DPI-1047 - unless you enable the optional Thick mode which has a few additional features, see Enabling python-oracledb Thick mode.