Tuesday, October 18, 2005

cx_Oracle and Ubuntu

Naturally, after getting Oracle working, my next move was to get it Python-powered by installing cx_Oracle. Installation seemed to go OK, but when I tried to use it...

>>> import cx_Oracle
Traceback (most recent call last):
File "", line 1, in ?
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory
which seemed odd, because
catherine@ubuntu:~$ locate libclntsh.so.10.1
I extrapolated a solution from an old mailing-list post by Karl Putland: I appended /app/oracle/oracle/product/10.2.0/db_1/lib to /etc/ld.so.conf and ran ldconfig.

That was the only trick - it's working fine now!


Anonymous said...

Hi Catherine - I'm a big Python and cx_Oracle fan and had a bit of a headache installing on Ubuntu but thanks to your pointers, went smooothly.

thanks for posting this out there!!


Anonymous said...


An alternative to adding this to /etc/ld.so.conf (which requires root rights) is to add the path to the environment variable LD_LIBRARY_PATH, like
export LD_LIBRARY_PATH=/app/oracle/oracle/product/10.2.0/db_1/lib:$LD_LIBRARY_PATH


Anonymous said...

Hello Catherine!!!

You are an angel :-) Thanks for the post. I was trying to figure out what was wrong with my cx_Oracle/Ubuntu/Oracle configuration. It took me 5 days but finally I came across your post and... It is working now!!!

Anonymous said...

Hi Catherine, you truly helped me on every problem I had with cx_oracle. This time I wanted to go to your post of how to setup cx_oracle, because I was getting the error talked about in this post when I used a different terminal window to run a script than the terminal I used to install everything with. But hey, I accidentally stumbled on this post and wow, exactly what I needed. You ROCK Catherine

Unknown said...

Wow... I know this is an old post, but glad that my pains helped you out.