3

I have export $ORACLE_HOME set to the directory containing all the instance client files. And LD_LIBRARY_PATH and DYLD_LIBRARY_PATH set to $ORACLE_HOME/ in my ~/.bash_profile.

I just can't seem to get past this error when I try import cx_Oracle in python:

ImportError: dlopen(/Library/Python/2.7/site-packages/cx_Oracle.so, 2): Library not loaded: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /Library/Python/2.7/site-packages/cx_Oracle.so
Reason: image not found

My Environment:

  • OS X El Capitan - 10.11.2
  • Python: 2.7
  • Oracle Instant Client - 64-bit:
    • instantclient-sdk-macos.x64-11.2.0.4.0.zip
    • instantclient-basic-macos.x64-11.2.0.4.0.zip

I can connect to the Oracle database using sqlplus without any issue.

Trimax
  • 2,413
  • 7
  • 35
  • 59
  • Found [this](http://stackoverflow.com/questions/33259671/how-to-install-cx-oracle-on-el-capitan), but didn't help either. – user5848732 Jan 27 '16 at 20:07
  • Have You managed to solve this problem? I am having the same issue on osx El Captian 10.11.3 (15D21) and read already a lot possible fixes but non of them worked. – modzello86 Feb 20 '16 at 19:10
  • Yes, I was able to resolve this issue. The main thing I learnt especially with OSX is that you don't want to use the python version that comes with Mac OS. So, here's what I did. 1) Install Virtualenv 2) create a virtual env 3) install cx_Oracle 4) Make sure you have downloaded the oracle drivers and you have set Oracle_HOME in your ~/.bash_profile – user5848732 Feb 26 '16 at 05:48
  • How did you resolve it? I can import cx_Oracle directly in Python, connect via sqlplus, but I'm getting this error when trying to use cx_Oracle in django. Like you, I've set it all up in a virtualenv. – Shawn May 09 '16 at 19:10
  • I found solution to problem very similar to this one on http://stackoverflow.com/questions/35231960/cx-oracle-importerror#35268217 – Robert Lujo Dec 16 '16 at 11:31
  • 2
    In my case, what had happened is that I had reinstalled **instantClient**, going up from 11.2 to 12.1. **cx-Oracle** (5.2) was installed when **instantClient** was 11.2. `pip install cx-Oracle --upgrade` bounced **cx-Oracle** up to 5.3 and that problem went away. And was promptly replaced by another - GRRRR Oracle -, but that's another story. – JL Peyret Jun 29 '17 at 20:44

0 Answers0