"error: cannot locate an Oracle software installation" When trying to install cx_Oracle


Newbie here trying to use python to do some database analysis. I keep getting the error: "error: cannot locate an Oracle software installation" When installing CX_oracle (via easy_install).

The problem is I do not have oracle on my local machine, I'm trying to use python to connect to the main oracle server. I have have setup another program to do this(visualdb) and I had a .jar file I used as the driver but I'm not sure how to use it in this case.

Any suggestions?

11/5/2012 2:43:23 PM

Accepted Answer

Don't use easy_install or pip, they don't really work very well for installing cx_Oracle since there are a number of environmental dependencies that the install scripts don't set up automatically. You need to get an oracle client driver, the quickest of which to find is the instantclient. Then point your ORACLE_HOME and PATH at the install location for the drivers, and install cx_Oracle itself. You should be good to go after that.

see: easy_install cx_Oracle (python package) on Windows

The question is about windows, but the answer includes info on *nix.

5/23/2017 12:17:00 PM

Install Oracle Client

  1. Download Oracle Client: http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

    Example: oracle-instantclient12.2-basic-

  2. Install Alien:

    sudo apt-get install alien
  3. install the RPM in the Ubuntu system:

    sudo alien -i oracle-instantclient12.2-basic-`
  4. Add to environment variables

    vim ~/.bashrc
    export ORACLE_HOME=/usr/lib/oracle/12.2/client64/lib/
    export LD_RUN_PATH=/usr/lib/oracle/12.2/client64/lib:$LD_RUN_PATH
    source ~/.bashrc
    sudo ln -s /usr/lib/oracle/12.2/client64 $ORACLE_HOME/include`


pip install cx-Oracle

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow