In my web application I have this piece of code:
from rdkit import Chem
This causes it to crash under apache, in logs I can see:
[Fri Sep 06 10:35:44 2013] [error] [client 172.22.69.51] ImportError: libRDGeneral.so.1: cannot open shared object file: No such file or directory
It looks like this problem is caused by LD_LIBRARY_PATH but I set it in my wsgi.py file:
os.environ['LD_LIBRARY_PATH']='/usr/lib/oracle/11.2/client64/lib:/nfs/public/rw/chembl/utils/RDKit_2012_09_1/lib:/nfs/public/rw/chembl/utils/indigo/lib/Linux/x64/'
as well as in VirtualHost apache conf:
<VirtualHost *:8787>
...
SetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib:/nfs/public/rw/chembl/utils/RDKit_2012_09_1/lib:/nfs/public/rw/chembl/utils/indigo/lib/Linux/x64/
</VirtualHost>
I can run this without problems from command line on the same machine:
(chembl_webservices)-bash-4.1$ export PYTHONPATH=/nfs/public/rw/chembl/utils/RDKit_2012_09_1/
(chembl_webservices)-bash-4.1$ export LD_LIBRARY_PATH=/nfs/public/rw/chembl/utils/RDKit_2012_09_1/lib
(chembl_webservices)-bash-4.1$ /nfs/public/rw/chembl/utils/virtualenvs/ldc/envs/chembl_webservices/bin/python
Python 2.7.5 (default, Aug 5 2013, 17:00:57)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import rdkit
from rdkit import Chem
And of course I can make my script print actual value of LD_LIBRARY_PATH so I know it's set correctly, the file and path exists and privileges are fine:
ls /nfs/public/rw/chembl/utils/RDKit_2012_09_1/lib -lh
-rwxr-xr-x 1 cbl_adm cbl_pub 406K Aug 8 11:13 libRDGeneral.so.1.2012.09.1
I can run ldd libRDGeneral.so.1.2012.09.1 to see that all dependencies are met:
linux-vdso.so.1 => (0x00007fff397ff000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00007f096ecd5000)
libm.so.6 => /lib64/libm.so.6 (0x00007f096ea50000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f096e83a000)
libc.so.6 => /lib64/libc.so.6 (0x00007f096e4a7000)
/lib64/ld-linux-x86-64.so.2 (0x00007f096f22d000)
So what's wrong? What else can I do? How can I debug it? Please help.