cx_Oracle on ubuntu 9.04 jaunty

Update 11.11.2011, for ubuntu 11.10 oneiric oncelot:

  • you will need version: cx_Oracle-5.0.4-11g-py27-1.x86_64.rpm
  • if using 64bit and you installed oracle on 32 bit thus also installed libaio1:i386 the replace /lib/libaio.1.0.1 32bit with the corresponding version for 64bit or you’ll get:
import cx_Oracle
ImportError: libaio.so.1: wrong ELF class: ELFCLASS32
  • if you try to use a newer version of cx_Oracle you will get
import cx_Oracle
ImportError: /usr/lib/python2.7/cx_Oracle.so: undefined symbol: PyUnicodeUCS2_AsEncodedString
End update.

Short list:

  • find python version
python -V
Python 2.6.2
  • download appropriate rpm version: cx_Oracle-5.0.2-10g-py26-1.i386.rpm
  • install rpm using alien (as root or using sudo)
alien -i cx_Oracle-5.0.2-10g-py26-1.i386.rpm
  • fix location
cd /usr/lib/python2.6
ln -s site-packages/cx_Oracle.so
  • test
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/phantom/oracle (path to instantclient install)
..$ python -c 'import cx_Oracle'

if you don’t do the export you will get a:

python -c 'import cx_Oracle'
Traceback (most recent call last):
 File "<string>", line 1, in <module>
ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory
Related Posts with Thumbnails
Be Sociable, Share!

5 Responses

  1. Your second line under the “fix” section appears wrong (bad syntax to create a symbolic link) but I’m not sure what it should be. Can you assist?

  2. Thanks, corrected.

  3. Thanks, I just setup cx_oracle on my 64-bit ubuntu 11.10

  4. This worked, thanks

  5. This worked even with 12.04

Leave a Reply

*