setting up cx_Oracle

Hi, guys, I get an error in pycharm when it's trying to load cx_Oracle package
I installed cx_Oracle through pip install from within a virtual environment, set the environment variables for oracle client in the virtual environment (ORACLE_HOME, DYLD_LIBRARY_PATH and LD_LIBRARY_PATH), and I can see the values I set when I print them out by running a python script from within the IDE.  This is the error pycharm outputs to the logs:

2015-03-12 17:29:20,697 [  15795]   INFO - .skeletons.PySkeletonGenerator - Skeleton for cx_Oracle failed on /Users/mariya/environment_1/portals_env/bin/python2.7. stderr: –
Failed to process 'cx_Oracle' while nothing yet: dlopen(/Users/mariya/environment_1/portals_env/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/mariya/environment_1/portals_env/lib/python2.7/site-packages/cx_Oracle.so
  Reason: image not found

Something wrong with my environment or is it package related?
Thanks in advance for any pointers.
2 comments
Comment actions Permalink
Hello,
I'm running into the exact same thing. Have you found a fix for this?
0
Comment actions Permalink
So I found the solution in my case. I'm running a Flask/SQLAlchemy app locally on a MacBook Pro via Apache/mod_wsgi. The way I fixed it was to edit the .plist for apache and add the cx_Oracle environment variables there.

so in the command line:

sudo vim /System/Library/LaunchDaemons/org.apache.httpd.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Disabled</key>
        <true/>
        <key>Label</key>
        <string>org.apache.httpd</string>
        <key>EnvironmentVariables</key>
        <dict>
<key>XPC_SERVICES_UNAVAILABLE</key>
<string>1</string>
<key>DYLD_LIBRARY_PATH</key>
<string>/path/to/your/oracle/instantclient_11_2:$DYLD_LIBRARY_PATH</string>
        </dict>
        <key>ProgramArguments</key>
        <array>
<string>/usr/sbin/httpd</string>
<string>-D</string>
<string>FOREGROUND</string>
        </array>
        <key>OnDemand</key>
        <false/>
</dict>
</plist>

Then after saving the file, I restarted apache and all was good with the world. Hope this helps someone.
0

Please sign in to leave a comment.