Error: DPI-1047 using Instant Client on macOS Catalina 10.15
I recently upgrade my mac to Mac OS Catalina Beta version. After that cx-Oracle is not working. Fails with error message below.
cx_Oracle.DatabaseError: DPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1): image not found". See https://oracle.github.io/odpi/doc/installation.html#macos for help
Version Python 3.7.4 cx-Oracle 7.2.0
This looks to me due to Apple dropping support of 32-bit apps. Can you confirm?
Hi, I am facing the same question. My High Sierra "server" holding Oracle 12c on Oracle Linux 7.4 as a guest of VirtualBox uses Instant Oracle Client 12.2 et cx_Oracle 7.3 for Python 3.7 and Anaconda 1.9.12.
It's running without any problem. Today I tried with an extra MacBook Pro 15 2017 running Catalina to prepare a specific setup of everything I need and I have already seen potential "issues" with Python 3.8 have installed too quickly ... (still need to replace it by 3.7.x (?) more stable and compliant with Oracle too... so I stop and need to think. I'lll come back in the future with more details ... Keep in touch Daniel
It's a known request, but no ETA.
Are we able to follow up the request somewhere?
@ufkl contacting your Oracle sales rep / account manager would be one way.
Hi, I have installed Oracle Instant Client 18.1 on Catalina and it's working perfectly with sqlplus connection. A nice youtube guy published he own installation here: https://www.youtube.com/watch?v=2btVupGXRtM
I am continuing with Python and cx_Oracle ... 1) select the right version as I am using a 12c release 1... Cheers
Hi, 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: Origine: (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)
hear 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
Do someone have the same problem?
Hi, 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: Origine: (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)
hear 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
Do someone have the same problem?
According to @cjbj & the download page (around the bottom page of https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html), Oracle Instant Client is not yet supporting MacOS Catalina.
@kindjacket @cjbj
Hi guys,
allowing to run apps downloaded from anywhere helped me fix the issue with this

Here you can find how to change your settings: https://www.imore.com/how-open-apps-anywhere-macos-catalina-and-mojave
All you need to do, before install everything type in terminal:
sudo spctl --master-disable
maybe you will have to go to System Preferences and set the correct security selection:

and after that install Oracle Instant Client
Hi, 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: Origine: (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)
hear 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
Do someone have the same problem?
I also got the same problem with your it just happen after i install 10.15.4.
Hi! I am having similar issues! I upgraded to Catalina. 19_3 stopped working. I tried to connect to the database, using cx_Oracle client. I get the following error: error msgDPI-1047: Cannot locate a 64-bit Oracle Client library: "dlopen(libclntsh.dylib, 1) Python, cx_Oracle Client and cx_oracle are 64 bit. Gave permissions (777) to /opt/oracle. I'm not using unbundled Python
Mac = Catalina Oracle instant client = 18.1 Cx_oracle = 7.3.0
LM0000152:~ payal.pandey$ which python3 /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 I used python3 -m pip install cx_Oracle --upgrade for installation.
LM0000152:lib payal.pandey$ ls libclntsh.dylib ojdbc6-11.2.0.3.jar LM0000152:lib payal.pandey$ pwd /Users/payal.pandey/lib
LM0000152:instantclient_18_1 payal.pandey$ ls BASIC_README libociei.dylib adrci libocijdbc18.dylib genezi libons.dylib libclntsh.dylib liboramysql18.dylib libclntsh.dylib.18.1 network libclntshcore.dylib.18.1 ojdbc8.jar libnnz18.dylib ucp.jar libocci.dylib uidrvci libocci.dylib.18.1 xstreams.jar
LM0000152:instantclient_18_1 payal.pandey$ pwd /opt/oracle/instantclient_18_1
It'd be great if anyone could suggest how else can I troubleshoot? I followed this for troubleshooting: https://cx-oracle.readthedocs.io/en/latest/user_guide/installation.html#troubleshooting
Hello! I have also the same problem. Is anybody solved this issue? Would be glad, if smb helped me. I've tried everything even 18.1, 12.2 oracle client, but did not work.
Mac: Catalina Version: 10.15.5
Tried adding the Instant Client directory to the DYLD_LIBRARY_PATH environment variable? It might help. The users of the node-oracledb driver have found it helps them on Catalina. But it would only help if you set the variable in the process/shell that directly invokes Python.
Also look at the current master branch and try out the new init_oracle_client() method, see the development documentation at https://github.com/oracle/python-cx_Oracle/blob/master/doc/src/user_guide/initialization.rst The instructions here show how to compile & install from the GitHub source code.
- Step One is done: export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:~/lib
- I am new user of mac, just 3 weeks ago switched from windows to mac, I have some problems while installing from github:
python3 system.py install, while entering this command, i got an error: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py:475: UserWarning: Normalizing '8.0.0-dev' to '8.0.0.dev0' normalized_version, running install error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the installation directory:
[Errno 2] No such file or directory: '/Library/Python/3.7/site-packages/test-easy-install-65425.write-test'
The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:
/Library/Python/3.7/site-packages/
This directory does not currently exist. Please create it and try again, or choose a different installation directory (using the -d or --install-dir option).
Step me through it. Where did you install Python from?
I installed from https://www.python.org/downloads/mac-osx/
Is there any problem with Python?
On Catlina with Python 3.8.3 from https://www.python.org/downloads/mac-osx/, perhaps the easiest thing to do is set DYLD_LIBRARY_PATH to your Instant Client directory. I tested with cx_Oracle 7.3 and Instant Client 19.3. Note that the environment variable won't propagate to sub-shells, so you need to set the environment variable in each terminal or process that starts Python. With cx_Oracle 8 you can also use the new cx_Oracle.init_oracle_client() function - check the dev doc. To get over your directory error, perhaps try python3 system.py install --user. Keep an eye on where all the cx_Oracle.cpython-38-darwin.so files get installed in case you need to manually clean some up.
I could not see a way to get the system installed Python 3.7 to work.
Here's a solution:
Update to cx_Oracle 8 and add something like this to your scripts:
import platform
if platform.platform()[:6] == 'Darwin':
cx_Oracle.init_oracle_client(lib_dir="/Users/yourname/instantclient_19_3")
The first time you run this, you'll have to use the macOS security preferences page to allow 3 or 4 Instant Client libraries to be accessed.
Other alternatives are discussed in the cx_Oracle 8 Installation guide and the new cx_Oracle 8 Initialization documentation.
For example, the file:
import sys
import os
import platform
import cx_Oracle
if platform.platform()[:6] == 'Darwin':
cx_Oracle.init_oracle_client(lib_dir="/Users/cjones/instantclient_19_3")
print("- platform.platform: ", platform.platform())
print("- sys.maxsize > 2**32: ", sys.maxsize > 2**32)
print("- platform.python_version:", platform.python_version())
print("- cx_Oracle.version: ", cx_Oracle.version)
print("- cx_Oracle.clientversion:", cx_Oracle.clientversion())
connection = cx_Oracle.Connection(os.environ.get("PYTHON_USERNAME"), os.environ.get("PYTHON_PASSWORD"), os.environ.get("PYTHON_CONNECTSTRING"))
print("- DB version: ", connection.version)
print("- encoding: ", connection.encoding)
print("- nenecoding: ", connection.nencoding)
gives this for me:
- platform.platform: Darwin-18.7.0-x86_64-i386-64bit
- sys.maxsize > 2**32: True
- platform.python_version: 3.7.7
- cx_Oracle.version: 8.0.0
- cx_Oracle.clientversion: (19, 3, 0, 0, 0)
- DB version: 19.3.0.0.0
- encoding: UTF-8
- nenecoding: UTF-8
I did all the steps. I installed cx_Oracle python3 -m pip install cx_Oracle --upgrade --user
nodir@MacBook-Pro-3 ~ % cd ./Library/Python/3.8/lib/python/site-packages
nodir@MacBook-Pro-3 site-packages % ls
cx_Oracle-8.0.0-py3.8.egg-info cx_Oracle.cpython-38-darwin.so libclntsh.dylib
Then, I run the code, It gives for me an error: `nodir@MacBook-Pro-3 ~ % python3 test.py
- platform.platform: macOS-10.15.5-x86_64-i386-64bit
- sys.maxsize > 2**32: True
- platform.python_version: 3.8.3
- cx_Oracle.version: 8.0.0
- cx_Oracle.clientversion: (19, 3, 0, 0, 0)
Traceback (most recent call last):
File "test.py", line 16, in
connection = cx_Oracle.Connection(os.environ.get("PYTHON_USERNAME"), os.environ.get("PYTHON_PASSWORD"), os.environ.get("PYTHON_CONNECTSTRING")) cx_Oracle.DatabaseError: ORA-12162: TNS:net service name is incorrectly specified `
That's a completely different problem. Your install and configuration were fine. Do some research into your connect string format. Here's some doc that will help: https://cx-oracle.readthedocs.io/en/latest/user_guide/connection_handling.html#connection-strings
Open a new issue instead of posting to this one. Thanks!