JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for TB-SUPPORT Archives


TB-SUPPORT Archives

TB-SUPPORT Archives


TB-SUPPORT@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

TB-SUPPORT Home

TB-SUPPORT Home

TB-SUPPORT  November 2012

TB-SUPPORT November 2012

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: pythonpath & multiple pythons

From:

Gareth Roy <[log in to unmask]>

Reply-To:

Testbed Support for GridPP member institutes <[log in to unmask]>

Date:

Fri, 16 Nov 2012 13:17:13 +0000

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (204 lines)

Hi Matt,

That makes _much_ more sense :)

I've seen the "new behaviour" before, usually what is happening is that a C interface has changed and python doesn't handle it very well and so seg faults or it's calling out to a system library of the wrong bit-ness (in my case a hand rolled 64bit python was trying to link to 32bit libtime.so). Neither of which is probably going to help in this case.

As for PYTHONPATH, unfortunately according to this http://docs.python.org/2/tutorial/modules.html#the-module-search-path it's working as expected... the PYTHONPATH variable kinda overrides everything else so if it's being set it'll look in that location. I know you can stop looking at PYTHONPATH by calling python with "-E", but then you have to add the places you want in the script by appending to the sys.path. I don't know enough about how the tarball works to know what is getting set and not set.

The other way to deal with this is to use virtualenv but I'm not sure that'll work in a production environment but I know it's functionality is being added to python3 for exactly this sort of thing.

Sorry no help here :(

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 12:48
To: [log in to unmask]
Subject: Re: pythonpath & multiple pythons

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.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>> >

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager