[Baypiggies] Talking to Oracle from Python on a mac 10.5 ?

Ned Deily nad at acm.org
Sat Mar 13 05:26:50 CET 2010

In article 
<64e45fca1003121446v751bf084x135a8ee243be8245 at mail.gmail.com>,
 Seth Friedman <sfseth at gmail.com> wrote:
> I find myself working in an Oracle environment with an intel Mac running
> 10.5.8, and getting the Python connectivity to Oracle just seems to be far
> more difficult than seems reasonable.
> With Oracle Instantclient and zx_Oracle I tried all the instructions I could
> find online, a few different versions, and in all the different cases, it
> blows up on the import:
> seths-macbook-pro:py seth$ python -c 'import cx_Oracle'
> Traceback (most recent call last):
>   File "<string>", line 1, in <module>
>   File "build/bdist.macosx-10.3-fat/egg/cx_Oracle.py", line 7, in <module>
>   File "build/bdist.macosx-10.3-fat/egg/cx_Oracle.py", line 6, in
> __bootstrap__
> ImportError:
> dlopen(/Users/seth/.python-eggs/cx_Oracle-5.0.3-py2.6-macosx-10.3-fat.egg-tmp/
> cx_Oracle.so,
> 2): Symbol not found: _OCIAttrGet
>   Referenced from:
> /Users/seth/.python-eggs/cx_Oracle-5.0.3-py2.6-macosx-10.3-fat.egg-tmp/cx_Orac
> le.so
>   Expected in: dynamic lookup
> I've got to think it's possible, by mortals, to open a connection to a 10g
> Oracle instance, from Python, in this kind of Mac.   I do hope I'm not being
> naive there.

I don't have any personal experience with cx_Oracle or Oracle's client 
libraries from OS X but, from Googling around, it seems that others have 
had the same problem symptom:


If I understand the situation correctly, that problem may have been 
either a result of using the PPC-only version of the libraries or an 
ABI-level mismatch, i.e. attempting to use the Intel libraries targeted 
for 10.5 with a Python that was targeted for 10.3 and up.  From the path 
above I'm guessing you also may have installed the python.org python 
2.6.  Make sure you have the Intel-version of the Oracle client libs and 
try installing with a 10.5-targeted Python.  The Apple-supplied 
python2.5 in /usr/bin should be OK.  Or you can use MacPorts (for sure) 
or Homebrew (haven't tried it myself) to install a Python 2.6 built 
specifically for 10.5.  Or you can build your own framework if you're 
careful prior to running configure:
And you may need to set DYLD_LIBRARY_PATH to point at the lib directory 
of the client lib.

If you still have problems, you might want to ask on either the 
cx-oracle or macpython lists:


 Ned Deily,
 nad at acm.org

More information about the Baypiggies mailing list