Sunday, 24 April 2016

ImportError undefined symbol: lo_truncate64

If you are getting above error in psycopg2 , then for sure on loading an older libpq library is used than the one with which the psycopg2 was installed.

To identify which libpq is the is using issue below command, the output of command should point to right file which is latest

ldd /path/to/venv/lib/python2.6/site-packages/psycopg2/ | grep libpq => /usr/pgsql-9.4/lib/ (0x00007f0d6c027000)

if above output is the correct .so file and you are still getting above error then, try to locate in default libraries like /usr/lib64 (on centOS), For me it was below under /usr/lib64
lrwxrwxrwx.  1 root root       12 Mar 31 10:15 ->
-rwxr-xr-x.  1 root root   162760 Feb 25  2014

As you can see the for some reason is trying to load above which is an older one. So I removed this softlink file and created a new one which points to /usr/pgsql-9.4/lib/ in /usr/lib64, by
issuing below commands
cd /usr/lib64
ln -s /usr/pgsql-9.4/lib/

Above should fix the issue.

No comments:

Post a Comment