cx_Oracle: distutils.errors.DistutilsSetupError: cannot locate Oracle include files even with SDK
Asked Answered
E

1

3

Trying to install cx_Oracle for Python 3.4 on Centos. I have installed Oracle client 11.2.0.1 (actually has two copies, as one requires encrypted connection while the other doesn't, so I have /usr/lib/oracle/11.2/client64 and /usr/lib/oracle/11.2.99/client64)

$ echo $ORACLE_HOME
/usr/lib/oracle/11.2/client64

$ python3.4 --version
Python 3.4.3

I have the SDK installed:

$ ls -all $ORACLE_HOME/sdk/include
total 1640
drwxrwxr-x 2 root root   4096 Aug 15  2009 .
drwxrwxr-x 4 root root   4096 Aug 15  2009 ..
-r-xr-xr-x 1 root root  42534 Aug 15  2009 ldap.h
-r--r--r-- 1 root root  34157 Aug 15  2009 nzerror.h
-r--r--r-- 1 root root  74787 Aug 15  2009 nzt.h
-r--r--r-- 1 root root  11586 Aug 15  2009 occiAQ.h
-r--r--r-- 1 root root  34750 Aug 15  2009 occiCommon.h
-r--r--r-- 1 root root  70685 Aug 15  2009 occiControl.h
-r--r--r-- 1 root root  39751 Aug 15  2009 occiData.h
-r--r--r-- 1 root root   2115 Aug 15  2009 occi.h
-r--r--r-- 1 root root  24778 Aug 15  2009 occiObjects.h
-r-xr-xr-x 1 root root   7203 Aug 15  2009 oci1.h
-r--r--r-- 1 root root  10361 Aug 15  2009 oci8dp.h
-r--r--r-- 1 root root 431290 Aug 15  2009 ociap.h
-r-xr-xr-x 1 root root   6204 Aug 15  2009 ociapr.h
-r--r--r-- 1 root root  43001 Aug 15  2009 ocidef.h
-r-xr-xr-x 1 root root   4048 Aug 15  2009 ocidem.h
-r--r--r-- 1 root root  11339 Aug 15  2009 ocidfn.h
-r--r--r-- 1 root root   8953 Aug 15  2009 ociextp.h
-r--r--r-- 1 root root 170958 Aug 15  2009 oci.h
-r-xr-xr-x 1 root root   6494 Aug 15  2009 ocikpr.h
-r--r--r-- 1 root root   4670 Aug 15  2009 ocixmldb.h
-r--r--r-- 1 root root  94528 Aug 15  2009 ocixstream.h
-r--r--r-- 1 root root  23266 Aug 15  2009 odci.h
-r-xr-xr-x 1 root root   6540 Aug 15  2009 oratypes.h
-r--r--r-- 1 root root  15083 Aug 15  2009 orid.h
-r--r--r-- 1 root root 102775 Aug 15  2009 ori.h
-r--r--r-- 1 root root 157901 Aug 15  2009 orl.h
-r--r--r-- 1 root root  42626 Aug 15  2009 oro.h
-r--r--r-- 1 root root 116645 Aug 15  2009 ort.h
-r-xr-xr-x 1 root root   9892 Aug 15  2009 xa.h

I also have python-devel installed:

$ sudo yum install python34u-devel
Loaded plugins: security
Setting up Install Process
Package python34u-devel-3.4.3-2.ius.centos6.x86_64 already installed and latest version
Nothing to do

Still, the installation fails:

$ sudo pip3.4 install cx_oracle
Collecting cx-oracle
  Using cached cx_Oracle-5.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/tmp/pip-build-zo2vjgvs/cx-oracle/setup.py", line 201, in <module>
        includeDirs = FindInstantClientRPMInclude(instantClientRPMLib)
      File "/tmp/pip-build-zo2vjgvs/cx-oracle/setup.py", line 144, in FindInstantClientRPMInclude
        raise DistutilsSetupError("cannot locate Oracle Instant Client " \
    distutils.errors.DistutilsSetupError: cannot locate Oracle Instant Client SDK RPM header files

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zo2vjgvs/cx-oracle
Eames answered 15/7, 2015 at 16:27 Comment(0)
E
3

Well, after lot of trial and errors it turns out the problem was that I had these two Oracle client libraries I used to separate an "encryption required" and "encryption not required" client. As soon as I removed the second one, the cx_Oracle installed just worked.

/usr/lib/oracle/11.2/client64

/usr/lib/oracle/11.2.99/client64

It is a shame, that Oracle doesn't have a way to set encryption PER CONNECTION, only can be set for the whole client, so I need two clients if I want to connection sometimes on an encrypted way and sometimes with no encryption.

Eames answered 15/7, 2015 at 16:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.