So I found Help installing cx_Oracle but am still stuck. I downloaded the latest instantclient from oracle, and set ORACLE_HOME to the location of the extracted files (both
Honestly it is a hell of a lot easier to install cx_Oracle from one of the binary installers they have, than from source.
Browse to Instant Client for Linux x86 download page.
Download the latest version of basic, sqlplus and sdk packages that fit your architecture (32 or 64bits):
oracle-instantclient-basic-..rpm oracle-instantclient-sqlplus-..rpm oracle-instantclient-devel-..rpm .Install the RPMs using alien. For example, at the time of this writing:
$ sudo alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
Add necessary environment variables (I personally did put it in /etc/environment then logoff/back in to reload the env):
ORACLE_HOME=/usr/lib/oracle//client64/lib/
LD_LIBRARY_PATH=/usr/lib/oracle//client64/lib/
Fix oracle's includes:
$ sudo ln -s /usr/include/oracle//client $ORACLE_HOME/include # for 32bits arch, OR
$ sudo ln -s /usr/include/oracle//client64 $ORACLE_HOME/include # for 64bits arch
Create /etc/ld.so.conf.d/oracle-instantclient and /etc/ld.so.conf.d/oracle.conf (for more recent versions, at least since 12.1) containing:
/lib
/usr/lib/oracle//client/lib ; for 32bits arch, OR
/usr/lib/oracle//client64/lib ; for 64bits arch
Reload ldconfig cache (use -v flag if you want some verbose):
$ sudo ldconfig
You might need to install libaio1.
Assuming we have installed Oracle Instant Client 10, you have different alternatives to install cx_Oracle:
$ pip install cx_oracle (linux only)Older versions (version less than 5.1.2 are .msi and .rpm files) can be downloaded from here. Install the RPMs using alien. For example, at the time of this writing:
$ sudo alien -i cx_Oracle-5.0-10g-py25-1.x86.rpm
To test, python -c 'import cx_Oracle; print cx_Oracle' should return the modules with its version.