6

I have installed oracle client and oracle client-dev, and setup ORACLE_HOME environment variable. Yet when I attempt to install tux_oracle (python setup.py build) I get the following: fatal error: oci.h: No such file or directory

asked Nov 25, 2011 at 8:47
0

3 Answers 3

6

Well, the answer is to install cx_Oracle not tx_Oracle. The way to do it in Ubuntu is the following:

  1. You must have the oracle client installed in your PC. If not download from oracle http://www.oracle.com/technetwork/topics/linuxsoft-082809.html.
  2. Install alien in your PC to be able to convert rpm to deb:
sudo apt-get -i alien
  1. Convert the rpm to deb:
sudo alien -d oracle-instantclient11.2-sqlplus-11.2.0.2.0.i386.rpm
  1. Install
    sudo dpkg -i oracle-instantclient11.2-basic_11.2.0.2.0-2_i386.deb
  2. Set ORACLE_HOME environment variable in /etc/profile.d by creating a file oracle.sh which must contain:
export ORACLE_HOME=/usr/lib/oracle/11.2/client
source oracle.sh
  1. Update LD_LIBRARY_PATH:
sudo vi /etc/ld.so.conf.d/oracle.conf which must contain: 
"$ORACLE_HOME/lib"
sudo ldconfig
  1. Download and install cx_Oracle (depending on the version of oracle and python you are using) from http://cx-oracle.sourceforge.net/ Again convert rpm to deb using alien and install:
sudo alien -d cx_Oracle-5.1-11g-py32-1.i386.rpm
sudo dpkg -i cx-oracle_5.1-2_i386.deb
  1. cx_Oracle gets installed in /usr/lib/python2.7/dist-packages/. You must do: sudo mv site-packages/cx_Oracle* dist-packages/ sudo rmdir site-packages/ sudo ln -s dist-packages site-packages

Now you should have no problem connecting to oracle. From python type:

import cx_Oracle

To connect to the database specify a connection string in tsnames.ora or directly:

connection_string = 'username/password@(DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA= (SID=MY_SID)))'
sbj3
2172 silver badges11 bronze badges
answered Dec 2, 2011 at 10:22
Sign up to request clarification or add additional context in comments.

1 Comment

is installing cx_oracle similar on x64 python/os?
1

I am using cx_oracle to connect to my Oracle database. Did you give it a try?

answered Nov 25, 2011 at 12:00

Comments

1

That header file can be found in the development suite. For some reason, it's not included in the default distribution package. Have a look at

http://my.opera.com/onyxluo/blog/cannot-find-oci-h-in-oracle9-2-client

Here's the page content, for your convenience. I got it from Google cache as the page was down when I got there.

The reason of this problem is because OCI (Oracle Call Interface)package is not installed in Oracle9.2 client. The default path of "oci.h" is $ORACLE_HOME/rdbms/demo. This problem doesn't exist on Oracle Database 9.2.0.1. But for Oracle 9.2.0.1 client, OCI package is not included in client even if you select the full package of client installation.

Solution:

  1. install Oracle 9.2.0.1 client first.
  2. In OUI(Oracle Universal Installer), use the same oracle home with Oracle 9.2.0.1 client, and then select Oracle Database install.
  3. Choose Customized in database installation
  4. Uncheck Enterprise Manager and Oracle Database and others except OCI and OCCI.

After OCI installed, $ORACLE_HOME/rdbms/demo will contain oci.h and other *.h files.

answered Nov 25, 2011 at 14:23

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.