Re: segfault on psycopg2 on CentOS - Mailing list psycopg

From Adrian Klaver
Subject Re: segfault on psycopg2 on CentOS
Date
Msg-id 5500D7E5.9080707@aklaver.com
Whole thread Raw
In response to Re: segfault on psycopg2 on CentOS  (Ed Davison <EDavison@getmns.com>)
List psycopg
On 03/11/2015 04:45 PM, Ed Davison wrote:
> On 03/11/2015 07:51 AM, Ed Davison wrote:
>> On Wed, Mar 11, 2015 at 2:00 PM, Ed Davison <EDavison@getmns.com> wrote:
>>
>>
>>> Starting program: /usr/bin/python2.7 -c 'import psycopg2; print psycopg2'
>>
>> ...
>>
>>> "/opt/python2.7.8/lib/python2.7/site-packages/psycopg2/_psycopg.so",
>>
>> I think you have some python path confusion and you are mixing up two python environments compiled with different
parameters.Try running /opt/python2.7.8/bin/python instead. 
>>
>> --
>>
>> Results:
>>> /opt/python2.7.8/bin/python manage.py
>> Segmentation fault
>>>
>>
>> Results from "/opt/python2.7.8/bin/python -v manage.py " :
>> ...
>> import psycopg2 # directory /opt/python2.7.8/lib/python2.7/site-packages/psycopg2
>> # /opt/python2.7.8/lib/python2.7/site-packages/psycopg2/__init__.pyc matches
/opt/python2.7.8/lib/python2.7/site-packages/psycopg2/__init__.py
>> import psycopg2 # precompiled from /opt/python2.7.8/lib/python2.7/site-packages/psycopg2/__init__.pyc
>> dlopen("/opt/python2.7.8/lib/python2.7/site-packages/psycopg2/_psycopg.so", 2);
>> Segmentation fault
>>
>>
>
> Hmm, so how did you install psycopg2?
>   From source or a package?
>
> I installed form source since CentOS only has psycopg2 for python 2.4.3 and I need python 2.7 for Django.  So, I did
a"python2.7 setup.py install" to get it installed into the python2.7 tree. 

Well that seems OK on the face of it. I would do as Daniele suggested:

1) ldd /path/to/_psycopg.so

2) Create a virtualenv and do a build inside of it.

In addition I have a suggestion.

In the directory that you built psycopg2 in do:

python setup.py clean --all

then

python setup.py build

There will a bunch of copy commands then the gcc commands. Copy and
paste the gcc output here, so we can see what it is building against.

My suspicion is that you are inadvertently cross compiling against some
Python 2.4.3 libraries.

>
> Ed
>


--
Adrian Klaver
adrian.klaver@aklaver.com


psycopg by date:

Previous
From: Ed Davison
Date:
Subject: Re: segfault on psycopg2 on CentOS
Next
From: Octavi Fors
Date:
Subject: Fwd: error in cur.mogrify line