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

libclntsh.dylib library is not getting loaded on connection #92

Closed CodePanda007 closed 7 years ago

CodePanda007 commented 7 years ago
  1. What is your version of Python? Is it 32-bit or 64-bit?

Python 2.7.10 64 bit

  1. What is your version of cx_Oracle?

'6.0.2'

  1. What is your version of the Oracle client (e.g. Instant Client)? How was it installed? Where is it installed?

64-bit - 12.1.0.2.0 Download instantclient,sdk,sqlplus from oracle macOS X86_64 and unzipped /Users/user/instantclient_12_1

and followed the installation instruction to the letter, SQLplus works without any issues and able to connect to the same database

  1. What is your version of the Oracle Database?

12c

  1. What is your OS and version?

macOS Sierra 10.12.6

  1. What compiler version did you use? For example, with GCC, run

gcc --version. gcc --version Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 9.0.0 (clang-900.0.37) Target: x86_64-apple-darwin16.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin

  1. What environment variables did you set? How exactly did you set them?

export ORACLE_HOME=/Users/user/instantclient_12_1 export TNS_ADMIN=$ORACLE_HOME export LD_LIBRARY_PATH=$ORACLE_HOME export DYLD_LIBRARY_PATH=$ORACLE_HOME

  1. What exact command caused the problem (e.g. what command did you try to install with)? Who were you logged in as?

I have admin privileges to the machine, have logged in as local user-- which has all the permissions

Command Executed: python Python 2.7.10 (default, Feb 7 2017, 00:08:15) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import cx_Oracle cx_Oracle.connect('user_name/password@listener_name')

  1. What error(s) you are seeing?

Traceback (most recent call last): File "", line 1, in cx_Oracle.DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "dlopen(libclntsh.dylib, 1): image not found". See https://oracle.github.io/odpi/doc/installation.html#macos for help

Did check on all the instructions on "https://oracle.github.io/odpi/doc/installation.html#macos" and had already did all the required changes for links

adding ls -al for the oracle_home and lib folders

blr-mphha:instantclient_12_1 user$ pwd /Users/user/instantclient_12_1 blr-mphha:instantclient_12_1 user$ ls -alrt total 476520 -rwx------@ 1 user 600 342 Apr 24 2015 glogin.sql -rwx------@ 1 user 600 18742 May 6 2015 ODBC_IC_Readme_Unix.html -rwx------@ 1 user 600 4445 Jan 14 2016 odbc_update_ini.sh -rwx------@ 1 user 600 238764 Jun 8 2016 libons.dylib -rwx------@ 1 user 600 54507 Jun 8 2016 orai18n-mapping.jar -rwx------@ 1 user 600 101327 Jun 8 2016 orai18n.jar -rwx------@ 1 user 600 4532196 Jun 8 2016 libclntshcore.dylib.12.1 -rwx------@ 1 user 600 71202 Jun 8 2016 xstreams.jar -rwx------@ 1 user 600 485 Jun 8 2016 BASIC_README -rwx------@ 1 user 600 483 Jun 8 2016 JDBC_README -rwx------@ 1 user 600 485 Jun 8 2016 TOOLS_README -rwx------@ 1 user 600 489 Jun 8 2016 SQLPLUS_README drwx------@ 4 user 600 136 Jun 8 2016 help -rwx------@ 1 user 600 5893409 Feb 28 2017 ojdbc6_g.jar -rwx------@ 1 user 600 5926802 Feb 28 2017 ojdbc7dms_g.jar -rwx------@ 1 user 600 5903105 Feb 28 2017 ojdbc7_g.jar -rwx------@ 1 user 600 3719559 Feb 28 2017 ojdbc6.jar -rwx------@ 1 user 600 5917140 Feb 28 2017 ojdbc6dms_g.jar -rwx------@ 1 user 600 4429061 Feb 28 2017 ojdbc6dms.jar -rwx------@ 1 user 600 4437635 Feb 28 2017 ojdbc7dms.jar -rwx------@ 1 user 600 3726335 Feb 28 2017 ojdbc7.jar drwx------@ 9 user 600 306 Mar 30 2017 sdk -rwx------@ 1 user 600 9892 Mar 30 2017 xa.h -rwx------@ 1 user 600 123766 Mar 30 2017 ort.h -rwx------@ 1 user 600 42866 Mar 30 2017 oro.h -rwx------@ 1 user 600 158261 Mar 30 2017 orl.h -rwx------@ 1 user 600 15083 Mar 30 2017 orid.h -rwx------@ 1 user 600 102775 Mar 30 2017 ori.h -rwx------@ 1 user 600 6506 Mar 30 2017 oratypes.h -rwx------@ 1 user 600 30429 Mar 30 2017 odci.h -rwx------@ 1 user 600 105155 Mar 30 2017 ocixstream.h -rwx------@ 1 user 600 7848 Mar 30 2017 ocixmldb.h -rwx------@ 1 user 600 6494 Mar 30 2017 ocikpr.h -rwx------@ 1 user 600 8953 Mar 30 2017 ociextp.h -rwx------@ 1 user 600 11782 Mar 30 2017 ocidfn.h -rwx------@ 1 user 600 4048 Mar 30 2017 ocidem.h -rwx------@ 1 user 600 43001 Mar 30 2017 ocidef.h -rwx------@ 1 user 600 6204 Mar 30 2017 ociapr.h -rwx------@ 1 user 600 434446 Mar 30 2017 ociap.h -rwx------@ 1 user 600 10361 Mar 30 2017 oci8dp.h -rwx------@ 1 user 600 7203 Mar 30 2017 oci1.h -rwx------@ 1 user 600 189648 Mar 30 2017 oci.h -rwx------@ 1 user 600 24778 Mar 30 2017 occiObjects.h -rwx------@ 1 user 600 39934 Mar 30 2017 occiData.h -rwx------@ 1 user 600 72561 Mar 30 2017 occiControl.h -rwx------@ 1 user 600 35604 Mar 30 2017 occiCommon.h -rwx------@ 1 user 600 11649 Mar 30 2017 occiAQ.h -rwx------@ 1 user 600 2115 Mar 30 2017 occi.h -rwx------@ 1 user 600 75006 Mar 30 2017 nzt.h -rwx------@ 1 user 600 36543 Mar 30 2017 nzerror.h -rwx------@ 1 user 600 44851 Mar 30 2017 ldap.h -rwx------@ 1 user 600 7477 Mar 30 2017 fix_oralib.rb -rwx------@ 1 user 600 5415256 Mar 30 2017 libsqora.dylib.12.1 -rwx------@ 1 user 600 1565732 Mar 30 2017 libsqlplusic.dylib -rwx------@ 1 user 600 1272840 Mar 30 2017 libsqlplus.dylib -rwx------@ 1 user 600 79524 Mar 30 2017 liboramysql12.dylib -rwx------@ 1 user 600 159884 Mar 30 2017 libocijdbc12.dylib -rwx------@ 1 user 600 109548524 Mar 30 2017 libociei.dylib -rwx------@ 1 user 600 1483956 Mar 30 2017 libocci.dylib.12.1 -rwx------@ 1 user 600 9173288 Mar 30 2017 libnnz12.dylib -rwx------@ 1 user 600 13980 Mar 30 2017 libheteroxa12.dylib -rwx------@ 1 user 600 67437336 Mar 30 2017 libclntsh.dylib.12.1 -rwx------@ 1 user 600 40352 Mar 30 2017 genezi -rwx------@ 1 user 600 10100 Mar 30 2017 adrci -rwx------@ 1 user 600 799008 Mar 30 2017 wrc -rwx------@ 1 user 600 150228 Mar 30 2017 uidrvci -rwx------@ 1 user 600 8552 Mar 30 2017 sqlplus drwx------ 7 user 600 238 Jun 30 18:26 .. -rwx------@ 1 user 600 303 Oct 6 18:55 sqlnet.ora -rwx------@ 1 user 600 1967 Oct 6 21:57 tnsnames.ora lrwxr-xr-x 1 user 600 20 Oct 9 13:04 libclntsh.dylib -> libclntsh.dylib.12.1 lrwxr-xr-x 1 user 600 18 Oct 9 13:04 libocci.dylib -> libocci.dylib.12.1 drwx------@ 73 user 600 2482 Oct 9 13:10 .

blr-mphha:lib user$ pwd /Users/user/lib blr-mphha:lib user$ ls -al total 48 drwx------ 8 user 600 272 Oct 9 13:07 . drwx------+ 74 user 600 2516 Oct 10 22:44 .. lrwxr-xr-x 1 user 600 57 Oct 9 13:07 libclntsh.dylib -> /Users/user/instantclient_12_1/libclntsh.dylib lrwxr-xr-x 1 user 600 62 Aug 18 17:10 libclntsh.dylib.12.1 -> /Users/user/instantclient_12_1/libclntsh.dylib.12.1 lrwxr-xr-x 1 user 600 66 Aug 18 17:11 libclntshcore.dylib.12.1 -> /Users/user/instantclient_12_1/libclntshcore.dylib.12.1 lrwxr-xr-x 1 user 600 56 Aug 18 17:12 libnnz12.dylib -> /Users/user/instantclient_12_1/libnnz12.dylib lrwxr-xr-x 1 user 600 56 Aug 18 17:13 libociei.dylib -> /Users/user/instantclient_12_1/libociei.dylib lrwxr-xr-x 1 user 600 54 Aug 18 17:12 libons.dylib -> /Users/user/instantclient_12_1/libons.dylib

cjbj commented 7 years ago

Thanks for the detail.

Python 2.7.10 happens to be the system version of Python. This is locked down. See the proviso : "On macOS make sure you are not using the bundled Python - use Homebrew or Python.org instead."

Other things I noted:

CodePanda007 commented 7 years ago

Changed to brew python and started working fine.

Thanks a lot cjbj.