0

I’m having an issue with instantclient. I was following the exact instructions in the http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html#ic_osx_inst to install Instant Client 11.2 on macOS.

However, when starting the server in the command line it return the following error: DatabaseError: DPI-1047: 64-bit Oracle Client library cannot be loaded: "dlopen(libclntsh.dylib,

  1. What is your version of Python? Is it 32-bit or 64-bit? 64-bit

  2. What is your cx_Oracle version? The latest version as of today, I believe it's 6.4.1

  3. What exact command caused the problem (e.g. what command did you try to install with)? When executing this command ‘python manage.py’ to run the application

  4. What error(s) you are seeing?

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

In my bash profile I have these established:

export PATH="/usr/local/mysql/bin:$PATH"
export PATH=/usr/local/sbin:/usr/local/bin:$PATH
# Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc
export WORKON_HOME=$HOME/Virtualenvs
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
export VIRTUALENVWRAPPER_PYTHON=/usr/local/Cellar/python@2/2.7.15_1/bin/python2.7
export VIRTUALENVWRAPPER_VIRTUALENV=usr/local/Cellar/python@2/2.7.15_1/bin/virtualenv
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
export TNS_ADMIN=/usr/local/oracle/instantclient_11_2
source /usr/local/bin/virtualenvwrapper.sh
export PATH="/usr/local/opt/gettext/bin:$PATH"
if [ -f $(brew --prefix)/etc/bash_completion ]; then
    source $(brew --prefix)/etc/bash_completion
fi
export PATH=~/instantclient_11_2:$PATH
# Setting PATH for Python 2.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
user248462
  • 85
  • 1
  • 5
  • " when starting the server in the command line ..." - what *server* are you starting? How, exactly? Your StackOverflow *background* isn't rich so I can't decide whether you know what you are doing or not (I'm not trying to insult you!). Because, when saying "server", to me it sounds as if you wanted to start up your Oracle database. Well, Oracle (instant) **client** is NOT a database (server). It is just bunch of programs that allow you work with a database. Client contains more of them, instant client not that many. Could you explain what you're doing? Sorry if I misunderstood the question. – Littlefoot Aug 27 '18 at 15:06
  • @Littlefoot I'm starting the nginx server. As the programming language I use 'Python 2.7' as u can see in bash profile. I want to know the possible cause of that error. – user248462 Aug 27 '18 at 16:17
  • Aha. Apparently, I did misunderstand the question. I know nothing about "nginx server" (whatever that is). I hope that someone else will be able to help. – Littlefoot Aug 27 '18 at 19:17
  • Did you look at this? https://gist.github.com/rmoff/5a70862f27d2284e9541 – Bobby Durrett Aug 27 '18 at 22:59
  • Looks like you just aren't finding the main Oracle client dynamic library. I haven't used an Oracle client on a Mac but on Windows and Linux this kind of thing happens all the time so you just need to get your path and your environment variables right. – Bobby Durrett Aug 27 '18 at 23:01

2 Answers2

1

Review the installation notes for cx_Oracle: https://cx-oracle.readthedocs.io/en/latest/installation.html#installing-cx-oracle-on-macos. Note especially the first sentence -- you cannot use the OS installation of Python!

Anthony Tuininga
  • 6,388
  • 2
  • 14
  • 23
0

If anyone is still getting the error DPI-1047 in Python, you might want to upgrade cx_Oracle. The latest major version (which supersedes cx_Oracle 8.3) has a new name python-oracledb. By default this new version doesn't need Oracle Client libraries. Check the installation documentation.

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48