Build and Install cx_Oracle on Mac Leopard Intel
I finally succeeded in building and installing cx_Oracle on a Mac. I will outline the steps that I took. There are many redundant steps that I may later take out. But there are checks that I made on the way that really helped.
The first Mac that I installed cx_Oracle was a 2.4 GHz Intel Core 2 Duo running Mac OSX 10.6.6. It had 4 GB of Memory. Most of my work was done on a terminal window.
Check Python Installation
The OSX comes with a Python interpreter. I ran a check to find the version number.
$ python -V
Python 2.6.1
This was sufficient for my needs. I decided not to upgrade to Python version 2.7.1
Xcode from Apple
The Xcode package is available from Apple Developer. You will need a login account but that is free. Now you do not need Xcode 4. Xcode 3 is sufficient because all we are interested in is the gcc compiler. After you login look for a link that says Looking for Xcode 3? I downloaded X code 3.2.6 and iOS SDK 4.3. It was 4.1 GB in size and is best done when you know you will not be using your Mac.
After the download, the installation went off smoothly. I restarted the Mac and on a terminal window checked that the gcc compiler was installed correctly.
$ which gcc
/usr/bin/gcc
$ gcc -v
gcc version 4.2.1
You can also do
man gcc
to get the online manual for gcc.
Install Oracle Instant Client
The cx_Oracle has a dependency. It needs Oracle Instant Client from Oracle. Click on the link Instant Client for Mac OS X (Intel x86). Accept the license agreement and download Version 10.2.0.4 (64-bit). I tried the 32-bit and it does NOT work. You will need your Oracle account to download the following packages:
- instantclient-basic-10.2.0.4.0-macosx-x64.zip
- instantclient-sdk-10.2.0.4.0-macosx-x64.zip
I created a directory called oracle to unpack the packages. The pathname on my machine was /Users/utcs/oracle. On your machine, it will be your user name instead of utcs. I moved both the basic and sdk packages into the oracle directory and unzipped them. After unzipping the basic package I got a folder instantclient_10_2.
After unzipping the sdk package, I got a folder called instantclient_10_2-1. Inside that folder was another folder called sdk. I moved the folder named sdkinside the folder instantclient_10_2.
From a terminal window I changed directory to sdk. On my machine, the full path name was /Users/utcs/oracle/instantclient_10_2/sdk. There is another .zip file called ottclasses.zip. I unzipped that as follows:
$ unzip ottclasses.zip
It produced a folder called
oracle
. I changed directory to
/Users/utcs/oracle/instantclient_10_2
. I ran the following command to copy all the files in the
sdk
folder.
$ cp -R ./sdk/* .
$ cp -R ./sdk/include/* .
The last two commands may not have been necessary. But it makes it easier to locate the header files.
Setting up the Environment Variables
In my home directory /Users/utcs I created a .profile file. Its content was as follows:
export ORACLE_HOME=/Users/utcs/oracle/instantclient_10_2
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
Restart the machine. Open another terminal window and run the following commands to check that the environment variables have been set properly:
$ source .profile
$ echo $ORACLE_HOME
$ echo $DYLD_LIBRARY_PATH
$ echo $LD_LIBRARY_PATH
You should see the path names printed out correctly. I created two symbolic links in the $ORACLE_HOME directory (/Users/utcs/oracle/instantclient_10_2) as follows:
ln -s libclntsh.dylib.10.1 libclntsh.dylib
ln -s libocci.dylib.10.1 libocci.dylib
If you run the command
ls -l
in that directory you should see the symbolic links.
Building and Installing cx_Oracle
Download from SourceForge cx_Oracle version 5.0.4. You need to get the package that says Source Code only. In your Download folder you will find cx_Oracle-5.0.4.tar. I moved it to /Users/utcs/oracle. To untar, I used the following command:
tar -xvf cx_Oracle-5.0.4.tar
After untarring I had a subdirectory called cx_Oracle-5.0.4. In a terminal window I changed directory to /Users/utcs/oracle/cx_Oracle-5.0.4. I checked in that window that all the environment variables were set properly by doing
echo $ORACLE_HOME
echo $LD_LIBRARY_PATH
echo $DYLD_LIBRARY_PATH
which python
which gcc
I did not have administrative privileges on this Mac so to build I did
python setup.py build
I checked to output. There were many
warning
messages that I ignored. Even a single
error
message would have indicated that the build process did not succeed. I next installed cx_Oracle by
sudo env ORACLE_HOME=/WorkSpace/oracle/instantclient11.2 pip install cx_Oracle
或sudo env ORACLE_HOME=/path/to/instantclient python setup.py install
python setup.py install
The install also finished without any error messages.
Test the cx_Oracle installation
On a terminal window type python. It should bring up Python in interactive mode. Then type import cx_Oracle. It should add the package to your path without any errors. Get out of the interactive mode using Control-D.
Now copy and paste this script into a file called Check.py. Change the user name and run it on the command line.
import cx_Oracle, string, getpass
def main():
# Get password
pswd = getpass.getpass()
# Build connection string
user = "CS327E_jdoe"
host = "rising-sun.microlab.cs.utexas.edu"
port = "1521"
sid = "orcl"
dsn = cx_Oracle.makedsn (host, port, sid)
# Connect to Oracle and test
con = cx_Oracle.connect (user, pswd, dsn)
if (con):
print "Connection successful"
print con.version
else:
print "Connection not successful"
con.close()
main()
You should see Connection successful if all the other tests were successful.
-
Download Instant Client:
-
Unzip and move to /opt
-
Create symlink
$ cd /opt/instantclient_11_2/
$ ln -s libclntsh.dylib.11.1 libclntsh.dylib
-
[ This step might not be needed ]
Copy files:
sudo cp /opt/instantclient_11_2/sdk/include/*.h /usr/include/
sudo cp /opt/instantclient_11_2/*.dylib /usr/lib
sudo cp /opt/instantclient_11_2/sqlplus /usr/bin
-
Run pip install. If it needs root permission, su to root first. Make sure you do this rather than sudo because you need to set the environment variable in the correct shell
export ORACLE_HOME=/opt/instantclient_11_2
pip install cx_Oracle
-
Test:
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> conn_str = u'USER/PASSWORD@host.foo.com:1521/orcl'
>>> conn = cx_Oracle.connect(conn_str)
>>> c = conn.cursor()
>>> c.execute(u'select sysdate from dual')
>
>>> for row in c:
... print row
...
(datetime.datetime(2015, 2, 19, 15, 56, 5),)
>>>
If you get this:
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
Traceback (most recent call last):
File "", line 1, in
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
Then make sure you've set DYLD_LIBRARY_PATH correctly:
export DYLD_LIBRARY_PATH=/opt/instantclient_11_2/
Installing cx_Oracle on a Mac
So as previously mentioned, I got a Macbook Pro. Nearly two months later, I am loving it more and more. The only gripe I had was installing a specific package called cx_Oracle; a Python Oracle DB connection package. After a lot of attempts, I finally got a working copy installed on my local machine. I noticed there are many tutorials around the web, but they are a bit outdated, I am on Mavericks, so I will create a nice article not only for you guys, but also for myself.
Necessary Downloads:
- cx_Oracle — Source Code Only Option — (http://cx-oracle.sourceforge.net/)
- Oracle Instant Client Basic 64-bit (http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html)
- Oracle Instant Client SDK 64-bit (http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html)
Next Steps:
Assuming you downloaded all the above files, and they are found in your Downloads directory, run the following commands as sudo:
sudo su
mkdir /Users//oracle
mv /Users//Downloads/instantclient-* /Users//oracle
cd /Users//oracle
unzip instantclient-basic-macos.x64-11.2.0.3.0.zip
unzip instantclient-sdk-macos.x64-11.2.0.3.0.zip
cd instantclient_11_2/sdk
unzip ottclasses.zip
cd ..
cp -R ./sdk/* .
cp -R ./sdk/include/* .
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
vim ~/.bash_profile
Add the following lines (you may want to add these lines to your own accounts .bash_profile too):
export ORACLE_HOME=/Users//oracle/instantclient_11_2
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
Once you enter all the info, you should resource your bash_profile. After this, you setup instant client as well! I would validate all your settings are correct as well:
. ~/.bash_profile
echo $ORACLE_HOME # should be /Users/username_here/oracle/instantclient_11_2 if you followed this guide
echo $DYLD_LIBRARY_PATH # same as above
echo $LD_LIBRARY_PATH # same as above
which python # usually /usr/bin/python
which gcc # usually /usr/bin/gcc
If all of the above is set, then you are ready to proceed with the cx_Oracle Install!
. ~/.bash_profile
cd /Users/username_here/Downloads
tar -xzf cx_Oracle-5.1.2.tar.gz
cd cx_Oracle-5.1.2
sudo python setup.py build
sudo python setup.py install
If all went according to plan, it should have successfully installed! (if not post in the comments and I can help!) To test simply:
python
import cx_Oracle
# you may see some junk like:
/Library/Python/2.7/site-packages/cx_Oracle-5.1.2-py2.7-macosx-10.9-intel.egg/cx_Oracle.py:3: UserWarning: Module cx_Oracle was already imported from /Library/Python/2.7/site-packages/cx_Oracle-5.1.2-py2.7-macosx-10.9-intel.egg/cx_Oracle.pyc, but /Users/username_here/Downloads/cx_Oracle-5.1.2 is being added to sys.path
Hope this helps someone out there!
UPDATE:
Seems like Oracle made a change to the basic zip since this was posted, the step when you are setting up symlinks. If you used my guide previously and you did:
ln -s libclntsh.dylib.11.2 libclntsh.dylib
ln -s libocci.dylib.11.2 libocci.dylib
you should unlink your symlinks and this should be…
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
I have updated the article since!
UPDATE 2:
William Smith, a commenter on the article, said he still ran into an error where Oracle software could not be found. He was able to get past the issue by using “sudo -E” with when installing:
$ sudo -E python setup.py install
The “-E” flag on sudo ensures that the local environment variables are preserved with root when the command is run. Thanks! Check out his full comment: http://joelvasallo.com/?p=276#comments
Posted on December 11, 2013
Author jvasallo
Categories Development, LinuxToMac, Tutorials
I was also getting error while importing the module:
Traceback (most recent call last):
File “”, line 1, in
File “build/bdist.macosx-10.10-intel/egg/cx_Oracle.py”, line 7, in
File “build/bdist.macosx-10.10-intel/egg/cx_Oracle.py”, line 6, in __bootstrap__
ImportError: dlopen(/var/root/.python-eggs/cx_Oracle-5.2-py2.7-macosx-10.10-intel.egg-tmp/cx_Oracle.so, 2): Library not loaded: /ade/b/2649109290/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /var/root/.python-eggs/cx_Oracle-5.2-py2.7-macosx-10.10-intel.egg-tmp/cx_Oracle.so
Reason: image not found
“source ~/.bash_profile” solved the problem.
. ~/.bash_profile should be the same but doesn’t hurt to reload it again. Thanks for the feedback! Glad this helped.
Thanks Joel. It helped. Although, I was getting:
distutils.errors.DistutilsSetupError: cannot locate Oracle include files
I figured, the client sdk was missing. Downloading it and placing the include folder in $ORACLE_HOME, solved the problem.
For people who are facing similar issue, SDK can be downloaded from Oracle Downloads: http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
File: instantclient-sdk-macos.x32-11.2.0.4.0.zip
Be careful which SDK you install. If you are running a 32bit OS, then yes it should be ok. If you are running a 64-bit you need a 64-bit SDK. I include this as one part of the steps in the tutorial.
Regardless, glad you have a working setup now!
Thanks a lot Joel for sharing this.
Those instructions made my life easy to set cx_Oracle up seamlessly.
Hi Joel,
I guess i was in bit hurry to express my happiness .
after installations when I am trying to import cx_Oracle, it’s throwing error below :
kanan01:~ kanan$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import cx_Oracle
Traceback (most recent call last):
File “”, line 1, in
File “build/bdist.macosx-10.10-intel/egg/cx_Oracle.py”, line 7, in
File “build/bdist.macosx-10.10-intel/egg/cx_Oracle.py”, line 6, in __bootstrap__
ImportError: dlopen(/Users/kanan/.python-eggs/cx_Oracle-5.1.2-py2.7-macosx-10.10-intel.egg-tmp/cx_Oracle.so,2)
:Library not loaded: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /Users/kanan/.python-eggs/cx_Oracle-5.1.2-py2.7-macosx-10.10-intel.egg-tmp/cx_Oracle.so
Reason: image not found
I am new to python and Mac environment and not sure what went wrong .
export ORACLE_HOME=/Users/kanan/oracle/instantclient_11_2
export DYLD_LIBRARY_PATH=$ORACLE_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME
Can you please help me understanding the root cause of this error.
Hey so the build/install step worked fine?
Hi Joel,
Thanks for replying to the post.
Install part went well but while running build I got this warning:-
ld: warning: ignoring file /Users/kanan/oracle/instantclient_11_2/libclntsh.dylib, file was built for x86_64 which is not the architecture being linked (i386): /Users/kanan/oracle/instantclient_11_2/libclntsh.dylib
libclntsh.dylib -> libclntsh.dylib.11.1
libocci.dylib -> libocci.dylib.11.1
What are you running; 32bit or 64bit? The above guide is for 64-bit OS. The error above (is not the architecture being linked (i386)) refers that you are running a 32-bit OS!
Thanks for posting this. I just installed cx_Oracle on a new Mac with Yosemite and ran into the “cannot locate an Oracle software” issue. I was able to get past the issue by using “sudo -E” with when installing:
$ sudo -E python setup.py install
The “-E” flag on sudo ensures that the local environment variables are preserved with root when the command is run.
Also, I installed the sqlplus instant client libraries, and added the environment variable TNS_ADMIN=${ORACLE_HOME} to .bash_profile. TNS_ADMIN tells SQLPLUS where to look for a tnsnames.ora file.
After creating a tnsname.ora file in the $ORACLE_HOME directory, it was handy to use SQLPLUS to test connectivity to Oracle before testing it in Python with cx_Oracle. Once in Python, I used the following simple test to make sure cx_Oracle was working
>>> import cx_Oracle
>>> myDB = cx_Oracle.Connection(‘scott’,’tiger’,’orcl’)
>>> print myDB.version
12.1.0.2.0
I work with Oracle Endeca Information Discovery a lot and am finding myself doing more with Python to overcome shortcomings of ETL tools, so its nice to get cx_Oracle working on my Mac.
From Chicago’s West Loop,
William Smith
Great comment. Thanks for the feedback! I’ll add your fix to the updates for others to try as well!
Worked perfect for my macbook pro. Thanks a ton!!
Glad it helped!
Hi jvasallo –
I followed the instructions and it worked w/o any issues and the sym links was correctly created as well.
However when I try to import cx_Oracle I get this:
Any ideas .. ?
Thanks for sharing this article..
{ … snipped … }
Traceback (most recent call last):
File “”, line 1, in
File “build/bdist.macosx-10.9-x86_64/egg/cx_Oracle.py”, line 7, in
File “build/bdist.macosx-10.9-x86_64/egg/cx_Oracle.py”, line 6, in __bootstrap__
ImportError: dlopen(/Users/sinhara8/.python-eggs/cx_Oracle-5.1.2-py2.7-macosx-10.9-x86_64.egg-tmp/cx_Oracle.so, 2): Symbol not found: _OCIAttrGet
Referenced from: /Users/sinhara8/.python-eggs/cx_Oracle-5.1.2-py2.7-macosx-10.9-x86_64.egg-tmp/cx_Oracle.so
Expected in: flat namespace
in /Users/sinhara8/.python-eggs/cx_Oracle-5.1.2-py2.7-macosx-10.9-x86_64.egg-tmp/cx_Oracle.so
Hey rtim,
What I would do is, uninstall cx_Oracle. Then check the following:
Did you create the symbolic links for
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
Look at the note at the end of the article. For some reason, the version went from 12 to 11. Not sure which one you did.
Also, make sure in both your ROOT and User .bash_profile you have the oracle settings. Before, you run your install make sure you do echo $ORACLE_HOME to make sure your settings took. There is an issue with root not automatically sourcing the bash_profile on Mac. You can do: source .bash_profile
Hey jvasallo –
Thx for posting so quickly
The sym links and everything is correct ..But I realized after posting the question
that I made a stupid oversight and installed 32bit oracle clients instead of 64 Bit ..
I will revert everything and try again .. will update the post ..
That can usually do it. I’ve seen 32/64 bit oracle issues take down a few people. In setup, hope that was just it!
OS X Version: 10.9.5
Python 2.7
Hi, Everything went smooth until: sudo python setup.py install
And I got:
Traceback (most recent call last):
File “setup.py”, line 135, in
raise DistutilsSetupError(“cannot locate an Oracle software ” \
distutils.errors.DistutilsSetupError: cannot locate an Oracle software installation
Folks on SO are advising to get the client SDK… but that’s already done and installed in my ~/oracle/instantclient_11_2 from steps above! Do you know why it can’t find that?
Important note:
echo $ORACLE_HOME gives /Users/MYUSER/oracle/instantclient_11_2 as required.
Howdy Mario. I had a similar issue recently. I’ve started in getting the habit of not installing stuff on the root of my system but rather using virtualenvs. Regardless, I had dependency on this module for some legacy stuff :x.
1) I found out it is usually due to root not sourcing .bash_profile correctly. Can you try sudo su and then source ~/.bash_profile? Also make sure the library paths for python are set correctly. For me, I have my core OSX Python but a /usr/local/bin/pip. This means my core python would never load the modules installed locally I added this and all was good. export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages
2) Instead of trying to install it by building and such. I had better success, using pip. Can you try sudo pip install cx_Oracle? Also, make sure the paths are set in both the root and user profile.
OK so good news and bad news.
source’ing roots .bash_profile and then installing worked.
python
import cx_Oracle
did not complain.
Then I tried putting import cx_Oracle in IDLE and also in a sript run from IDLE and I got this mess:
Traceback (most recent call last):
File “”, line 1, in
import cx_Oracle
File “build/bdist.macosx-10.6-intel/egg/cx_Oracle.py”, line 7, in
File “build/bdist.macosx-10.6-intel/egg/cx_Oracle.py”, line 6, in __bootstrap__
ImportError: dlopen(/Users/MYUSER/.python-eggs/cx_Oracle-5.1.3-py2.7-macosx-10.6-intel.egg-tmp/cx_Oracle.so, 2): Library not loaded: /ade/b/3071542110/oracle/rdbms/lib/libclntsh.dylib.11.1
Referenced from: /Users/MYUSER/.python-eggs/cx_Oracle-5.1.3-py2.7-macosx-10.6-intel.egg-tmp/cx_Oracle.so
Reason: image not found
I actually went looking for a manual method to build because:
sudo pip install cx_Oracle
gives:
Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/cx-Oracle
Storing debug log for failure in /Users/MYUSER/Library/Logs/pip.log
So, at least I made it a little further.
Hmm…I also ran into this scary issue. Are you running this in a virtualenv?
Nope. This is OS 10.9
Hmm…ok. I think I know what the problem could be. Is there anyway we can do a Google Hangout or something?
Hi, I think I may have the solution but need to find time to work on this project again. Thanks for all your help, I will post again!
Glad to help. If you come up with the fix, let me know so I can add it to the article! Best of luck!
Out of curiosity… what was the fix? I’m running into this same issue?
I also had the “cannot locate an Oracle software” problem, although I had it on the “sudo python setup.py build” step. The solution was to use visudo to add ORACLE_HOME to the list of environment variables not blocked by sudo – or something like that – I found the details here: http://lorcancoyle.org/wiki/public/cxoracle, and they worked like a charm.
This post really helps, thank you!
This worked perfectly, thanks!
My current OS Version is:
OS X Version: 10.9.2
Build: 13C64
After all the configuration is done, while I try to build the setup.py; I get this error:
running build
running build_ext
building ‘cx_Oracle’ extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/opt/oracle/instantclient_10_2/sdk/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cx_Oracle.c -o build/temp.macosx-10.9-intel-2.7-10g/cx_Oracle.o -DBUILD_VERSION=5.1.2
clang: error: unknown argument: ‘-mno-fused-madd’ [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command ‘cc’ failed with exit status 1
Ah looks like you are facing the XCode 5.1 . Can you try and run the command with this before it:
CFLAGS=-Wunused-command-line-argument-hard-error-in-future
ex:
CFLAGS=-Wunused-command-line-argument-hard-error-in-future sudo python setup.py build
alternatively:
export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
sudo python setup.py build
Regardless you are not the only one. 5.1 introduced a lot of headaches with not only Python eggs based but also Ruby gems.
If you wish to read more about it: http://stackoverflow.com/a/22355874
Let me know if this helps and works! If not, we can try to resolve it further. If it does, I want to add this the tutorial and see if I can work with cx_Oracle to patch this.
Hi… I’m on Xcode 5.1 as well.
I tried both of your approaches and get the same error.
running build
running build_ext
building ‘cx_Oracle’ extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/Users/dgiles/instantclient_11_2/sdk/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cx_Oracle.c -o build/temp.macosx-10.9-intel-2.7-11g/cx_Oracle.o -DBUILD_VERSION=5.1.2
clang: error: unknown argument: ‘-mno-fused-madd’ [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command ‘cc’ failed with exit status 1
Any other thoughts on how to work round this?
Dom,
Looks like I possibly got a bit lazy. Can you try these three:
1)
>> CFLAGS=-Wunused-command-line-argument-hard-error-in-future python setup.py build
2)
>> export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future";
>> python setup.py build
3)
>> export CFLAGS="";
>> python setup.py build
Hi Joel… I think I’m pretty close… However. It seemed to compile and install.
I’m not sure how clear this going to be… but I’ve pasted the results of the install and running a simple cx_oracle import.
http://pastebin.com/fg54Y3YB
ADMIN EDIT: Sorry, normally don’t edit comments but for sake of readability I put the trace in pastebin.
Dom,
Which of the options helped you? I am going to take a crack and say it was the last one (which is the worst one sadly…:/).
On your terminal can you just:
python
import cx_Oracle
Hi Joel…
Sorry embedded in that mass of text was just that test import cx_oracle.
The pertinent error I get at the end of it is
ImportError: dlopen(/Library/Python/2.7/site-packages/cx_Oracle-5.1.2-py2.7-macosx-10.9-intel.egg/cx_Oracle.so, 2): Symbol not found: _C_SendHTTPRequest
Referenced from: /Users/dgiles/instantclient_11_2/libnnz11.dylib
I’ve check my paths… I think I’me good i.e.
echo $DYLD_LIBRARY_PATH
/Users/dgiles/instantclient_11_2
Any other thoughts?
Dom,
did you see my edit I just added today? I might have told you all to link to the wrong file. Oracle did a switch on me! Can you:
cd /Users/username_here/oracle/instantclient_11_2/
unlink libclntsh.dylib
unlink libocci.dylib
ln -s libclntsh.dylib.11.1 libclntsh.dylib
ln -s libocci.dylib.11.1 libocci.dylib
Hi Joel
Just cracked it… I was using an old instance client. The shame of it. I work for Oracle too…
Are you still looking for work?
Dom,
PEBKAC, happens all the time Glad to hear you got it up and running! Unfortunately, at this time I am not looking for work, but you know how the world is. Feel free to send me a Linkedin request, or just keep in touch!
Also out of curiosity, did any of my three solutions in the previous comment help you get past the build step? I would like to add it to the above for now. Long term, looks like some work needs to be done with cx_Oracle cause its a compiler flag issue. :X
Hi Joel…
It’s not unfortunate that you’re not looking for work.. Thats good news If things change you’ll be able to find me. to be honest I’m not sure which one cleared it… I tried all of them. and they all seemed to give the error. I then played around with some 32.64 bit settings… still got the error. Retried them one after another and hey presto… the first one worked. I really need to clean it all down and restart again. I know my way round Java but have checking out Python and have been pleasantly surprised by how easy things have been… I thought I’d try out the Oracle interfaces… Much harder than it needs to be. I’ll have to see what I can do to get some support behind the open source efforts… Thanks for your time… I’ll keep an eye on your blog.
Sometimes thats the way it is, and glad this might make an impact with the open source support! Have a good weekend and I’ll be sure to keep in touch
THANKS! The file I downloaded had different .dylib files… for some reason they changed them to 11.1 instead of 11.2
Awesome! Glad it helped! BTW, the reasoning for the change in version number is to match the version of instant client. I believe 11.1 matches 11.1 instant client and 11.2 is for 11.2 instant client!