Print

Print


Heya Gareth,

> I may have completely misunderstood what your trying to do (or you may already know this) but if your attempting to use *.pyc or *.pyo files in:
>
> /usr/lib64/python2.4/site-packages
>
> while running python 2.6 (which is what it appears you are doing from below)  then it probably should segfault (particularly if it's a C extension library) as major point releases of python are incompatible... i.e. you can't use precompiled blobs from 2.4 with 2.6, or 2.6 with 2.7. So for instance if you have 2.4 and 2.6 installed on a system there should be a:
>
> /usr/lib64/python2.4/site-packages
> /usr/lib64/python2.6/site-packages
>
> With packages/eggs installed in each site-packages directory... so for example the "lfc" package should have a 2.6 version.
>
> The easiest way to see what the interpreter thinks it's import path is, is to:
>
> [gareth@limbo ~ $ python
> Python 2.7.3 (default, Sep 26 2012, 21:51:14)
> [GCC 4.7.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import sys
>>>> sys.path
> ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PIL', '/usr/lib/python2.7/dist-packages/gst-0.10', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']
>>>>
>
> The PYTHONPATH env variable gets added to this list but there are other default things it searches for first. So if the ATLAS code is using python2.6 and trying to do and "import lfc" on a 2.4 library I'm not surprised it's segfaulting.
>
> As I said I may be misunderstanding what your trying to do, if so sorry!!

Thanks for the information (python is not my strongpoint so your clear 
explanation of sys.path is appreciated). There's a slight 
misunderstanding here. I don't expect the mismatched python versions to 
work, but the segfaulting is "new behaviour" - repeating these tests on 
my old glite nodes and python errors at you, fails to load the module, 
but doesn't crash. It's the crashing that causes the problem (as it 
seems to take the atlas pilot with it when this happens).

My problem is we're trying to develop the relocatable tarball, that puts 
site-packages in a non-standard place. This (AFAIKS) requires PYTHONPATH 
to be set (talking to John off-list reveals that PYTHONPATH doesn't 
appear to be set on his WNs). PYTHONPATH doesn't behave when you're 
dealing with multiple python versions with same-named modules as 
whatever version of python you're using will always look in the first 
place on the path and attempt to load the first matching named module it 
finds - even if it's for a wrong python version.

I just can't seem to coax the behaviour I want out of python - to load 
into the path only the version-specific site-packages dir.

Cheers,
Matt



>
> Gareth
>
>
> ________________________________________
> From: Testbed Support for GridPP member institutes [[log in to unmask]] On Behalf Of Matt Doidge [[log in to unmask]]
> Sent: 16 November 2012 11:48
> To: [log in to unmask]
> Subject: Re: pythonpath&  multiple pythons
>
> He
>> It segfault for me also
>> [root@node003 ~]# export PYTHONPATH=/usr/lib64/python2.4/site-packages
>> [root@node003 ~]# python26
>> Python 2.6.8 (unknown, Apr 12 2012, 20:59:36)
>> [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> import lfc
>> Segmentation fault
>> [root@node003 ~]# rpm -qa|grep emi-wn
>> emi-wn-2.0.1-1.el5.x86_64
>>
>> Does it need any fix ?
>>
>
> Thanks Govind. John also sees this at Cambridge. Nice to know that it's
> not just me.
>
> It almost certainly needs a fix, but I'm not sure who's problem it is.
> I'll have a poke to see if I can figure out why/how/where it's breaking,
> for example to see if it breaks on other modules in the 2.4
> site-packages area rather then erroring nicely like it should.
>
> Cheers,
> Matt
>>
>> On Fri, Nov 16, 2012 at 11:24 AM, Matt Doidge<[log in to unmask]>   wrote:
>>> Hello again all,
>>> Please could someone with access to an EMI2 worker node please do me a
>>> favour. Could they log onto the workernode and do something like:
>>>
>>> #export PYTHONPATH=/usr/lib64/python2.4/site-packages
>>> #python26
>>> import lfc
>>>
>>> To see if it seg faults like I'm seeing within the tarball distribution. If
>>> it does/doesn't can you let me know, along with the WN version (my version
>>> is 2.4.0-1).
>>>
>>> Many thanks,
>>> Matt
>>>
>>>
>>> On 11/15/2012 09:16 PM, Peter Love wrote:
>>>>
>>>> Matt, I'm submitting some test pilots to Lancs regarding python26 and
>>>> the new DDM tools, you may be seeing these. Let me know what you're
>>>> seeing off-list.
>>>>
>>>> Cheers,
>>>> Peter
>>>>
>>>> On 15 November 2012 17:26, Matt Doidge<[log in to unmask]>    wrote:
>>>>>
>>>>> I caught an atlas pilot job just as it failed,
>>>>>
>>>>> "ATLAS_PYTHON_PILOT set to /usr/bin/python"
>>>>>
>>>>> is there any way that I can point the jobs in the right python direction
>>>>> (2.6 in our case).
>>>>>
>>>>> Cheers,
>>>>> Matt
>>>>>
>>>>>
>>>>> On 11/15/2012 04:22 PM, Alessandra Forti wrote:
>>>>>>
>>>>>>
>>>>>> Indeed this should be handled by the experiment setup. They do calle
>>>>>> different python versions from different releases as far I'm aware. The
>>>>>> aspiration was to use only one version one day.
>>>>>>
>>>>>> cheers
>>>>>> alessandra
>>>>>>
>>>>>> On 15/11/2012 16:03, John Gordon wrote:
>>>>>>>
>>>>>>>
>>>>>>> Yesterday at GDB both LHCb and ATLAS mentioned supporting both Python
>>>>>>> 2.6 and 2.7. ATLAS said that setup.sh should allow an argument to
>>>>>>> specify the python version to use.
>>>>>>>
>>>>>>> That sounded like an aspiration not a solution they had today.
>>>>>>>
>>>>>>> -----Original Message-----
>>>>>>> From: Testbed Support for GridPP member institutes
>>>>>>> [mailto:[log in to unmask]] On Behalf Of Matt Doidge
>>>>>>> Sent: 15 November 2012 14:56
>>>>>>> To: [log in to unmask]
>>>>>>> Subject: pythonpath&    multiple pythons
>>>>>>>
>>>>>>> Hello all,
>>>>>>> I hit a snag with testing the wn tarball which may or may not be a
>>>>>>> wider
>>>>>>> issue with atlas jobs on emi - but it appears to me that some atlas
>>>>>>> production jobs are attempting to `import lfc` using python26 as well
>>>>>>> as/instead of regular python (2.4).
>>>>>>>
>>>>>>> The problem is that the when checking the modules in $PYTHONPATH python
>>>>>>> just picks up the first thing that matches the name of what it wants to
>>>>>>> load, and if that doesn't work it fails (or in the case of python26
>>>>>>> trying to load the 2.4 lfc modules that are in emi, python seg faults
>>>>>>> unceremoniously).
>>>>>>>
>>>>>>> Is there a way to gracefully have python switch between which directory
>>>>>>> to look up its modules depending on version, something other then the
>>>>>>> clunky PYTHONPATH? And has anyone else been seeing these kind of
>>>>>>> problems with their workers or possibly UIs?
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Matt
>>>>>>> -Sad that he couldn't think up a decent flying circus quip, but
>>>>>>> suspecting that they've all be done before.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>> >