Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"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?

like image 918
user1735075 Avatar asked Nov 05 '12 14:11

user1735075


People also ask

Do you need Oracle client for cx_Oracle?

Using cx_Oracle requires Oracle Client libraries to be installed. These provide the necessary network connectivity allowing cx_Oracle to access an Oracle Database instance. Oracle Client versions 19, 18, 12 and 11.2 are supported.

What is import cx_Oracle?

cx_Oracle is a Python extension module that enables access to Oracle Database. It conforms to the Python database API 2.0 specification with a considerable number of additions and a couple of exclusions. cx_Oracle 8.3 was tested with Python versions 3.6 through 3.10.

Is cx_Oracle open source?

cx_Oracle is distributed under an open-source license (the BSD license). A detailed description of cx_Oracle changes can be found in the release notes. cx_Oracle has a major new release under a new name and homepage python-oracledb.


1 Answers

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.

like image 59
Silas Ray Avatar answered Oct 11 '22 17:10

Silas Ray