I'm having a very strange issue that I can't quite figure out and hope you all can. Following the steps at this link, I've installed the Oracle instant client and cx_Oracle, and I can import cx_Oracle in Python no problem. I've done all of this in a virtualenv.
The issue is when I try
./manage.py runserver
I get
raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading cx_Oracle module:
dlopen(/Users/shawn/Virtual/Django18/lib/python2.7/site-packages/cx_Oracle.so,
2): Library not loaded: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /Users/shawn/Virtual/Django18/lib/python2.7/site-packages/cx_Oracle.so
Reason: image not found
Of course, that's exactly where the cx_Oracle.so file exists.
So I searched and found this SO question, but running the Ruby script actually breaks my cx_Oracle import in python, and doesn't resolve the django issue. Instead, it gives the error below, whether in Python directly or in the django environment. How do I fix this? I need to be able to import cx_Oracle in django! Thanks!
ImportError: dlopen(/Users/shawn/Virtual/Django18/lib/python2.7/site-packages/cx_Oracle.so,
2): Library not loaded: /Users/Shawn/Oracle/instantclient_11_2/
Referenced from: /Users/shawn/Virtual/Django18/lib/python2.7/site-packages/cx_Oracle.so
Reason: no suitable image found. Did find:
/Users/Shawn/Oracle/instantclient_11_2/: not a file
/Users/Shawn/Oracle/instantclient_11_2/: not a file
/usr/local/lib/: not a file
/usr/lib/: not a file
EDIT: I wiped and recreated my virtualenv. I then retried the Ruby script after I realized that I didn't run it in the same directory as the instant client executables. It ran and updated from
@executable_path/...
to
/Users/shawn/Oracle/...
I tried importing cx_Oracle in my virtualenv python and this time it worked instead of throwing an error. Unfortunately, trying to run my django server still blows up saying
Raise ImproperlyConfigured("Error loading cx_Oracle module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading cx_Oracle module: dlopen(/Users/shawn/Virtual/Django18/lib/python2.7/site-packages/cx_Oracle.so, 2): Library not loaded: libclntsh.dylib.11.1
Referenced from: /Users/shawn/Virtual/Django18/lib/python2.7/site-packages/cx_Oracle.so
Reason: image not found
I can't understand why python can import it but django cannot.