cx_Oracle: distutils.errors.DistutilsSetupError: cannot locate Oracle include files cx_Oracle: distutils.errors.DistutilsSetupError: cannot locate Oracle include files linux linux

cx_Oracle: distutils.errors.DistutilsSetupError: cannot locate Oracle include files


When you run setup.py it will check for any of these folders on your ORACLE_HOME.

possibleIncludeDirs = ["rdbms/demo", "rdbms/public", "network/public",        "sdk/include"]

Also the instant client sometimes places the include files, such as oci.h, in /usr/include/oracle//client, if there is no 'include' directory under ORACLE_HOME create a symbolic link to it.

sudo ln -s /usr/include/oracle/11.2/client $ORACLE_HOME/include

Looks like you're missing the Client SDK


  1. Install oracle_client_basic

    oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm
  2. Using pip install

    python -m pip install cx_Oracle
  3. Adding ldconfig

    1. Find your client location, for example: /u01/app/oracle/product/11.2.0/client_1/lib
    2. vi /etc/ld.so.conf.d/oracle.conf

      Add this location into it:

      /u01/app/oracle/product/11.2.0/client_1/lib
    3. ldconfig
  4. import cx_oracle