3

I installed the Oracle Instant Client version 19.3 on my Mac Os Catalina version 10.15.4 But i still have the same error on python3.7 and python3.8:

Origin: (cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1): no suitable image found. Did find: file system relative paths not allowed in hardened programs". See https://oracle.github.io/odpi/doc/installation.html#macos for help (Background on this error at: http://sqlalche.me/e/4xp6)

here is my installation:

$: ls-l ~/lib
ls -l ~/lib
total 0
lrwxr-xr-x 1 giacomocallegaro staff 58 22 Apr 09:13 libclntsh.dylib -> /Users/giacomocallegaro/instantclient_19_3/libclntsh.dylib

$: cat .zprofile

Setting PATH for Python 3.8

The original version is saved in .zprofile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}" export PATH

Setting PATH for Python 3.7

The original version is saved in .zprofile.pysave

PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH=$PATH:~/instantclient_19_3
export PATH

$: echo $PATH

/Users/giacomocallegaro/.nvm/versions/node/v12.14.1/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/giacomocallegaro/.nvm/versions/node/v12.16.1/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/opt/openssl/bin:/Users/giacomocallegaro/instantclient_19_3:/Users/giacomocallegaro/instantclient_19_3

$: which python:
/usr/bin/python

when I run sqlplus:

$: sqlplus -v

SQL*Plus: Release 19.0.0.0.0 - Production Version 19.3.0.0.0

Can some one help me please?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62

3 Answers3

2
  • Go to https://www.oracle.com/technical-resources/
  • Downloads --> Oracle Instant Client --> macOS(Intel x86) --> Basic Package
  • In your download folder you will find a folder named instantclient_19_3
  • Add the following to your python script
import cx_Oracle

cx_Oracle.init_oracle_client(lib_dir=r'/Users/<username>/Downloads/instantclient_19_3')

Some windows will pop up, so go to System preferences --> Security & Privacy --> General and there you will see a notification. Click on open anyway. You will have to repeat this last step 3-4 times.

Ricky
  • 57
  • 1
  • 8
2

After you download instant client from here, create a symbolic link into /usr/local/lib folder (that's where all .dylib files keep their symbolic links).

In my case, I extracted instant client into /opt/oracle/instantclient_19_3. So the command is:

$ ln -s /opt/oracle/instantclient_19_3/libclntsh.dylib /usr/local/lib/

However, there is another problem when I try to create the connection from python:

Error while trying to retrieve text for error ORA-01804

Oracle says: "Instant Client 19.3 and 18.1 support macOS Mojave and High Sierra", and I have macOS Catalina 10.15, don't know if this has anything to do with that, error 01804 says that timezone information is invalid.

More info on this: http://www.dba-oracle.com/t_ora_01804_start_oracle.htm

EDIT: issue resolved.

After downloading the SQL*Plus Package I managed to connect and verify the instant client works. My python issue was also resolved when I restarted IntelliJ (I was running the server from within so the PATH might have not been updated).

Agoun
  • 334
  • 3
  • 11
0

Maybe the error is misleading and it is related to general issue with Oracle Instant Client on MacOS Catalina? Have a look at this blog post:

Gary's Oracle On Tap

Hope this helps!

aurawindsurfing
  • 423
  • 4
  • 11