Re: [cx-oracle-users] import cx_Oracle failed with error "<type 'exceptions.ImportError'>: libclnts
Brought to you by:
atuining
|
From: Anthony T. <ant...@gm...> - 2014-02-04 04:53:58
|
Hi, Looks to me like a problem with your Apache configuration. Someone else posted this elsewhere which should help you out. :-) https://code.google.com/p/modwsgi/issues/detail?id=238 When Python Oracle extension was built it wasn't done so with LD_RUN_PATH set in environment so the .so would know were non standard place is that Oracle libraries are installed. As a result, you need to manually set LD_LIBRARY_PATH for Apache so Apache process nows where they are. To do this for standard ASF Apache installation you set: LD_LIBRARY_PATH=/some/path/to/oracle/libs export LD_LIBRARY_PATH in the 'envvars' file in same directory as Apache htttpd executable. Some Linux distributions do away with envvars file and you need to do it somewhere in init scripts for Apache. On Mon, Feb 3, 2014 at 8:17 PM, Thang Vu <Tha...@so...> wrote: > Hello list, > > > > I did install Python extension module cx_Oracle-5.1.2-11g-py26-1.x86_64.rpm > on CentOS 6.4 and linked Oracle client 11gR2 properly. I could run no > problem from Unix shell but I got error from import cx_Oracle > "libclntsh.so.11.1: cannot open shared object file: No such file or > directory" when running from Apache Web Server. > > > > It still failed despite I set ORACLE_HOME and LD_LIBRARY_PATH > ($ORACLE_HOME/lib) properly: in ~/.bashrc, /etc/ld.so.conf.d/oracle.conf, > ~/.bash_profile, anywhere I'm able to set an env var. > > > > Note: I did not have any issue with cx_Oracle when setup the same thing on > CentOS 5, so I suspect cx_Oracle might have running on CentOS 6. > > > > > > > > [root]# uname -a > > Linux zhuhiauto.prod.quest.corp 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 > 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux > > > > [root]# python -V > > Python 2.6.6 > > > > [root]#httpd -V > > Server version: Apache/2.2.15 (Unix) > > Server built: Feb 22 2013 11:19:58 > > Server's Module Magic Number: 20051115:25 > > Server loaded: APR 1.3.9, APR-Util 1.3.9 > > Compiled using: APR 1.3.9, APR-Util 1.3.9 > > Architecture: 64-bit > > Server MPM: Prefork > > threaded: no > > forked: yes (variable process count) > > > > [root]# export ORACLE_HOME=/oracle/products/112 > > [root]# export LD_LIBRARY_PATH=$ORACLE_HOME/lib > > [root]# yum --nogpgcheck install > /home/oracle/cx_Oracle-5.1.2-11g-py26-1.x86_64.rpm > > Loaded plugins: fastestmirror, refresh-packagekit, security > > Loading mirror speeds from cached hostfile > > * base: mirrors.163.com > > * extras: mirror.neu.edu.cn > > * updates: mirrors.163.com > > base > | 3.7 kB 00:00 > > extras > | 3.4 kB 00:00 > > updates > | > 3.4 kB 00:00 > > updates/primary_db > | 1.4 MB 00:00 > > Setting up Install Process > > Examining /home/oracle/cx_Oracle-5.1.2-11g-py26-1.x86_64.rpm: > cx_Oracle-5.1.2-1.x86_64 > > Marking /home/oracle/cx_Oracle-5.1.2-11g-py26-1.x86_64.rpm to be installed > > Resolving Dependencies > > --> Running transaction check > > ---> Package cx_Oracle.x86_64 0:5.1.2-1 will be installed > > --> Finished Dependency Resolution > > > > Dependencies Resolved > > > > > ============================================================================================================================================================ > > Package Arch > Version > Repository Size > > > ============================================================================================================================================================ > > Installing: > > cx_Oracle x86_64 > 5.1.2-1 /cx_Oracle-5.1.2-11g-py26-1.x86_64 > 986 k > > > > Transaction Summary > > > ============================================================================================================================================================ > > Install 1 Package(s) > > > > Total size: 986 k > > Installed size: 986 k > > Is this ok [y/N]: y > > Downloading Packages: > > Running rpm_check_debug > > Running Transaction Test > > Transaction Test Succeeded > > Running Transaction > > Warning: RPMDB altered outside of yum. > > Installing : cx_Oracle-5.1.2-1.x86_64 > 1/1 > > Verifying : > cx_Oracle-5.1.2-1.x86_64 > 1/1 > > > > Installed: > > cx_Oracle.x86_64 0:5.1.2-1 > > Complete! > > > > [root]# rpm -qa |grep cx_Oracle > > cx_Oracle-5.1.2-1.x86_64 > > > > [root]# ldd /usr/lib/python2.6/site-packages/cx_Oracle.so > > linux-vdso.so.1 => (0x00007fffcd9ff000) > > libclntsh.so.11.1 => /oracle/products/112/lib/libclntsh.so.11.1(0x00002b9fc49f7000) > > libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 > (0x00002b9fc7393000) > > libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b9fc7739000) > > libc.so.6 => /lib64/libc.so.6 (0x00002b9fc7956000) > > libnnz11.so => /oracle/products/112/lib/libnnz11.so > (0x00002b9fc7cea000) > > libdl.so.2 => /lib64/libdl.so.2 (0x00002b9fc80b6000) > > libm.so.6 => /lib64/libm.so.6 (0x00002b9fc82ba000) > > libnsl.so.1 => /lib64/libnsl.so.1 (0x00002b9fc853f000) > > libaio.so.1 => /lib64/libaio.so.1 (0x00002b9fc8758000) > > libutil.so.1 => /lib64/libutil.so.1 (0x00002b9fc8959000) > > /lib64/ld-linux-x86-64.so.2 (0x0000003997000000) > > [root]# > > > > > > #!/usr/bin/python > > > > import cgi > > import cgitb; cgitb.enable() > > import os, sys > > > > os.putenv('ORACLE_HOME','/oracle/products/112') > > os.putenv('LD_LIBRARY_PATH', '/oracle/products/112/lib') > > os.putenv('TNS_ADMIN','/oracle/products/112/network/admin') > > > > os.environ['ORACLE_HOME'] = '/oracle/products/112' > > os.environ['LD_LIBRARY_PATH'] = '/oracle/products/112/lib' > > os.environ['TNS_ADMIN'] = '/oracle/products/112/network/admin' > > > > import cx_Oracle > > > > > > http://test_server/cgi-bin/cgi_p3.py > > *<type 'exceptions.ImportError'>* > > Python 2.6.6: /usr/bin/python > Tue Feb 4 10:54:00 2014 > > A problem occurred in a Python script. Here is the sequence of function > calls leading up to the error, in the order they occurred. > > /var/www/cgi-bin/cgi_p3.py in () > > 12 os.environ['ORACLE_HOME'] = '/oracle/products/112' > > 13 os.environ['LD_LIBRARY_PATH'] = '/oracle/products/112/lib' > > 14 os.environ['TNS_ADMIN'] = '/oracle/products/112/network/admin' > > 15 > > 16 import cx_Oracle > > cx_Oracle *undefined* > > *<type 'exceptions.ImportError'>*: libclntsh.so.11.1: cannot open shared > object file: No such file or directory > args = ('libclntsh.so.11.1: cannot open shared object file: No such > file or directory',) > message = 'libclntsh.so.11.1: cannot open shared object file: No > such file or directory' > > > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > > http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |