To get work Django and Oracle client in Ubuntu:
Download cx_Oracle (choose for your system), Oracle InstantClient and Sql*Plus (in this page you can choose your OS and download the packages (in my case are oracle-instantclient11.2-basic-11.2.0.0.2-1.x86_64.rpm and oracle-instantclient11.2-sqlplus-11.2.0.0.2-1.x86_64.rpm).
Move the files into one directory for simplicity and run
alien -k *.rpm dpkg -i *.debto convert all the downloaded packages to ubuntu deb-format and install them.
Then make symlink to lib, otherwise module won't be found by Django
cd /usr/lib/python2.6 ln -s site-packages/cx_Oracle.so
To avoid
Traceback (most recent call last): File "add to ~/.bashrc (or /etc/bash.bashrc to system-wide apply)", line 1, in ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/oracle/11.2/client64/libIf you see the message
Traceback (most recent call last): File "run", line 1, in ImportError: libaio.so.1: cannot open shared object file: No such file or directory
sudo apt-get install -y libaio1
P.S. If you choose more modern (or older) version of Oracle IntstantClient you have to create symlinks for necessary version, e.g. you see the following error:
Traceback (most recent call last): File "but in /usr/lib/oracle/11.2/client64/lib directory exists libclntsh.so.11.1. Just make it symbolic link with", line 1, in ImportError: libclntsh.so.10.1: cannot open shared object file: No such file or directory
ln -s libclntsh.so.11.1 libclntsh.so.10.1
I found it is possible to avoid the need to kludge up your LD_LIBRARY_PATH:
ReplyDeleteMake a file /etc/ld.so.conf.d/oracle-instantclient11.1-basic.conf
containing
/lib
/usr/lib/oracle/11.2/client64/lib
then sudo ldconfig