By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,846 Members | 1,857 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,846 IT Pros & Developers. It's quick & easy.

installing cx_Oracle.

P: n/a
I am trying to use this:
http://python.net/crew/atuining/cx_O...cx_Oracle.html
it is a real module, right?

sudo easy_install cx_Oracle did not easy_install cx_Oracle.

http://www.python.org/pypi/cx_Oracle/4.3.1 doesn't give me any clue.

I got the source from
http://prdownloads.sourceforge.net/c...ar.gz?download

carl@dell17:~/a/cx_Oracle-4.3.1$ python setup.py build
Traceback (most recent call last):
File "setup.py", line 36, in ?
oracleHome = os.environ["ORACLE_HOME"]
File "/usr/lib/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'ORACLE_HOME'
Now I don't really know whos problem this is.

Carl K
May 24 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Carl K schrieb:
I am trying to use this:
http://python.net/crew/atuining/cx_O...cx_Oracle.html
it is a real module, right?

sudo easy_install cx_Oracle did not easy_install cx_Oracle.

http://www.python.org/pypi/cx_Oracle/4.3.1 doesn't give me any clue.

I got the source from
http://prdownloads.sourceforge.net/c...ar.gz?download
carl@dell17:~/a/cx_Oracle-4.3.1$ python setup.py build
Traceback (most recent call last):
File "setup.py", line 36, in ?
oracleHome = os.environ["ORACLE_HOME"]
File "/usr/lib/python2.4/UserDict.py", line 17, in __getitem__
def __getitem__(self, key): return self.data[key]
KeyError: 'ORACLE_HOME'
yours. because you need the oracle OCI with libs and header files
installed + the environment variable ORACLE_HOME pointing to the
installation.

I suggest you download the appropriat oracle instant client for your system.

Diez
May 24 '07 #2

P: n/a
Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
$ python setup.py build
$ sudo python setup.py install

$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or
directory

guessing I need to add
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
to some path?

btw - anyone know of a .deb that will install this?

Carl K
May 24 '07 #3

P: n/a
Carl K wrote:
Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
$ python setup.py build
$ sudo python setup.py install

$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or
directory

guessing I need to add
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
to some path?
You can `export
LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib`

or (assuming a recent RedHat linux (or similar) now), put that path in a
file, /etc/ld.so.conf.d/oracle.conf

and run /sbin/ldconfig

You'll find the latter operation to be persistent, and the former is not.
btw - anyone know of a .deb that will install this?

Carl K
May 24 '07 #4

P: n/a
Bill Scherer wrote:
Carl K wrote:
>Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
$ python setup.py build
$ sudo python setup.py install

$ python -c "import cx_Oracle"
Traceback (most recent call last):
File "<string>", line 1, in ?
ImportError: libclntsh.so.10.1: cannot open shared object file: No
such file or directory

guessing I need to add
/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib/
to some path?
You can `export
LD_LIBRARY_PATH=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client/lib`

or (assuming a recent RedHat linux (or similar) now), put that path in a
file, /etc/ld.so.conf.d/oracle.conf

and run /sbin/ldconfig

You'll find the latter operation to be persistent, and the former is not.
>btw - anyone know of a .deb that will install this?

Carl K
bingo.

carl@dell17:~/a/cx_Oracle-4.3.1$ python
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
[GCC 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>import cx_Oracle
connection = cx_Oracle.connect('testuserA', 'pw', 'nf55')
cursor = connection.cursor()
cursor.execute("select * from tbl1")
[<cx_Oracle.NUMBER with value None>, <cx_Oracle.FIXED_CHAR with value None>,
<cx_Oracle.NUMBER with value None>]
>>rows=cursor.fetchall()
rows
[(1, 'a ', 1.01), (2, 'a ', 1.02), (3, 'a ', 1.03)]

Thanks - now I can get to the real problem: client side join/order by :)

But I have already done it in MySql, so this should be the easy part...

Thanks again.

Carl K
May 24 '07 #5

P: n/a
Dennis Lee Bieber wrote:
On Thu, 24 May 2007 09:07:07 -0500, Carl K <ca**@personnelware.com>
declaimed the following in comp.lang.python:
>Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

Don't those lines need to be reversed? Set the variable in the
current shell, and /then/ export it?
Modern shells actually allow the single statement

export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
------------------ Asciimercial ---------------------
Get on the web: Blog, lens and tag your way to fame!!
holdenweb.blogspot.com squidoo.com/pythonology
tagged items: del.icio.us/steve.holden/python
All these services currently offer free registration!
-------------- Thank You for Reading ----------------

May 24 '07 #6

P: n/a
Dennis Lee Bieber wrote:
On Thu, 24 May 2007 09:07:07 -0500, Carl K <ca**@personnelware.com>
declaimed the following in comp.lang.python:
>Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

Don't those lines need to be reversed? Set the variable in the
current shell, and /then/ export it?
whoops - I may have cut/pasted too fast.

Carl K
May 24 '07 #7

P: n/a
On Thu, 2007-05-24 at 16:15 +0000, Dennis Lee Bieber wrote:
On Thu, 24 May 2007 09:07:07 -0500, Carl K <ca**@personnelware.com>
declaimed the following in comp.lang.python:
Getting closer, thanks Bill and Diez.

$ export ORACLE_HOME
$ ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client

Don't those lines need to be reversed? Set the variable in the
current shell, and /then/ export it?
It also works the other way around, at least on the non-empty set of
systems that contains my workstation. export simply marks the variable
name for automatic export to the environment of subsequent commands. The
value at that time doesn't matter. What matters is the value that the
name has at the time the command is run:

[carsten@dot ~]$ export FOOD
[carsten@dot ~]$ FOOD=spam
[carsten@dot ~]$ python -c "import os; print os.environ['FOOD']"
spam
[carsten@dot ~]$ FOOD=eggs
[carsten@dot ~]$ python -c "import os; print os.environ['FOOD']"
eggs

Regards,

--
Carsten Haese
http://informixdb.sourceforge.net
May 24 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.