Ask Your Question
0

psycopg2: ImportError libgnutls on Debian wheezy and sage-5.2-Ubuntu-10.04

asked 2012-08-10 18:17:47 -0500

fero gravatar image

updated 2015-01-13 14:47:32 -0500

FrédéricC gravatar image

Hi all,

I am deploying my Django app in sage-5.2-Ubuntu-10.04 on a Debian Wheezy.

Almost all succeeds but I need python psycopg2 in sage environment and I cannot make it working.

My problem is verified when I import psycopg2:

#

ImportError: /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2: symbol gnutls_certificate_get_x509_cas, version GNUTLS_1_4 not defined in file libgnutls.so.26 with link time reference

#

The symbol gnutls_certificate_get_x509_ca seems to be in /usr/lib/x86_64-linux-gnu/libgnutls.so.26 but not in /opt/sage-5.2-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/local/lib/libgnutls.so.26 that is checked because of the LD_LIBRARY_PATH setting.

Follow the story on how to reproduce it

sage -sh
esay_install --upgrade psycopg2

First error:

Processing psycopg2-2.4.5.tar.gz
Running psycopg2-2.4.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Vhfq2Z/psycopg2-2.4.5/egg-dist-tmp-sajtkC
no previously-included directories found matching 'doc/src/_build'
/usr/bin/ld: cannot find crti.o: No such file or directory
collect2: ld returned 1 exit status
error: Setup script exited with error: command 'gcc' failed with exit status 1

Following http://stackoverflow.com/questions/6329887/compiling-problems-cannot-find-crt1-o and I have done:

ln -s /usr/lib/x86_64-linux-gnu /usr/lib64
esay_install --upgrade psycopg2

Installed. WOW! BUT...

python
Python 2.7.3 (default, Jul 27 2012, 03:29:26) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/sage-5.2-linux-64bit-ubuntu_10.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/psycopg2-2.4.5-py2.7-linux-x86_64.egg/psycopg2/__init__.py", line 67, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2: symbol gnutls_certificate_get_x509_cas, version GNUTLS_1_4 not defined in file libgnutls.so.26 with link time reference

I cannot find out the way to get out of this problem, please help me if you can.

Thank you very much Luca

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2012-08-11 06:48:54 -0500

fero gravatar image

I downloaded source tarball sage-5.2.tar and compiled it as suggested in #debian. At the end of compilation my problem wasn't solved.

I have found the following hack that now seemds to work:

mkdir /opt/sage/local/libhacks
ln -s /usr/lib/x86_64-linux-gnu/libgnutls.so.26 /opt/sage/local/libhacks/
export LD_LIBRARY_PATH=/opt/sage/local/libhacks/:$LD_LIBRARY_PATH
BEFORE executing Django manage.py or Apache2 or whatever else has to do with psycopg2

I will write an update if it doesn't work...

fero

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-08-10 18:17:47 -0500

Seen: 798 times

Last updated: Aug 11 '12