import cx_Oracle failed with error "<type 'exceptions.ImportError'>: libclntsh.so.11.1: cannot open shared object file: No such file or directory "

Thang Vu <Thang.Vu-rbQqYLFhARZskZv2Y/7f+AC/[email protected]>
Newsgroups gmane.comp.python.db.cx-oracle
Message-ID <53B5DDE6B29C1841A057E784CEDDA34924C7250E@ALVMBXW02.prod.quest.corp>
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<file:///\\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-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.