[Rivet] The rivet Python module could not be loaded

Hao Liu hao.l at cern.ch
Mon Apr 28 18:56:40 BST 2014


Thank you so much for the great help and quick response. I will start to rewrite the source code of the plugin. 

Best,
Hao
On Apr 28, 2014, at 1:54 PM, Andy Buckley <andy.buckley at cern.ch> wrote:

> Hi Hao,
> 
> Glad that it works! That's definitely the easiest way.
> 
> You will need to rebuild your analysis plugin for the new platform and
> Rivet version, but this particular problem is because the Athena Rivet_i
> interface changed a little, and the attribute to set is now
> rivet.HistoFile rather than rivet.File.
> 
> Hope that helps
> Andy
> 
> 
> On 28/04/14 19:45, Hao Liu wrote:
>> Thank you so much Andy, I think I have another quick question here.
>> 
>> I finally choose to run it on SLC6, since the setup is easy and straight
>> forward.
>> After I asetup 19.0.1, I tried rivet —help and athena —help. They both
>> works perfectly. 
>> 
>> I was running athena and old version rivet on SLC5 before. So I have an
>> executable after compilation from rivet 1.8 on SLC5. 
>> Just now I tried to run athena by doing:
>> 
>> *athena jobconf_rivet.py (this one works fine on SLC5).*
>> *
>> *
>> While it gives me error saying below:
>> 
>> *Shortened traceback (most recent user call last):
>>  File "./jobconf_rivet.py", line 21, in <module>
>>    rivet.File = lpath+'/'+file2+'.aida'
>> AttributeError: 'Rivet_i' object has no attribute ‘File'*
>> *
>> *
>> I know that the aida would be cause some problem because we don’t use
>> aida anymore in Rivet 2.X. While here I don’t think it’s caused by the
>> aida thing. 
>> I am wondering is this because I am using the file compiled on SLC5
>> using an old version Rivet? I attached the jobconf_rivet.py below. The
>> azh_lltautau is from a rivet code I wrote for the analysis.
>> 
>> *theApp.EvtMax = -1
>> import AthenaPoolCnvSvc.ReadAthenaPool
>> import os
>> lpath = os.path.abspath('.')
>> input = lpath+'.txt'
>> file = open(input)
>> file2 = input.split('/')[-1][:-4] 
>> svcMgr.EventSelector.InputCollections = []
>> for line in file:
>> if line[-1] == '\n':
>> sline = line[:-1]
>> svcMgr.EventSelector.InputCollections.append(sline)
>> from AthenaCommon.AlgSequence import AlgSequence
>> job = AlgSequence()
>> from Rivet_i.Rivet_iConf import Rivet_i
>> rivet = Rivet_i()
>> 
>> rivet.AnalysisPath =
>> '/afs/cern.ch/work/h/hao/public/AZh_sys_accept/AZh_lltautau_analysis'
>> <http://cern.ch/work/h/hao/public/AZh_sys_accept/AZh_lltautau_analysis'>
>> rivet.Analyses += ['azh_lltautau']
>> 
>> rivet.File = lpath+'/'+file2+'.aida'
>> job += rivet
>> *
>> 
>> Best,
>> Hao
>> On Apr 28, 2014, at 12:34 PM, Andy Buckley <andy.buckley at cern.ch
>> <mailto:andy.buckley at cern.ch>> wrote:
>> 
>>> On 28/04/14 18:10, Hao Liu wrote:
>>>> Hi Andy,
>>>> 
>>>> I tried this one this time.
>>>> 
>>>> */afs/cern.ch/sw/lcg/external/MCGenerators_lcgcmt65/rivet/2.1.1/x86_64-slc5-gcc47-opt/rivetenv.sh
>>>> <http://cern.ch/sw/lcg/external/MCGenerators_lcgcmt65/rivet/2.1.1/x86_64-slc5-gcc47-opt/rivetenv.sh>
>>>> <http://cern.ch/sw/lcg/external/MCGenerators_lcgcmt65/rivet/2.1.1/x86_64-slc5-gcc47-opt/rivetenv.sh>*
>>>> *
>>>> *
>>>> while I got the same error. Is this caused by my environment?
>>>> The python I am using right now is */usr/bin/python*
>>> 
>>> The SLC5 (and 6) system Python and GCC aren't a supported LCG platform,
>>> so yes it's an environment thing.
>>> 
>>>> what do I need to do before I source this rivetenv.sh file?
>>> 
>>> First of all, do you really need to use SLC5? SLC6 is much more up to
>>> date and is what's installed on grid nodes now. If you can use SLC6 then
>>> the system Python will be ok, I think, and maybe you can even get away
>>> with the system GCC but I always set up a newer CC like this:
>>> 
>>> source
>>> /afs/cern.ch/sw/lcg/contrib/gcc/4.6/x86_64-slc6-gcc46-opt/setup.sh
>>> <http://cern.ch/sw/lcg/contrib/gcc/4.6/x86_64-slc6-gcc46-opt/setup.sh>
>>> 
>>> (or use an even newer one like 4.7 or 4.8 if that's what the Genser
>>> builds require)
>>> 
>>> To use a newer Python, do something like this:
>>> 
>>> PATH=/afs/cern.ch/sw/lcg/external/Python/2.6.5/x86_64-slc5-gcc46-opt/bin:$PATH
>>> <http://cern.ch/sw/lcg/external/Python/2.6.5/x86_64-slc5-gcc46-opt/bin:$PATH>
>>> 
>>> where the exact path depends on the Python version you need, whether
>>> you're using SLC5 or 6, and the GCC version.
>>> 
>>>> When I was setting up the old version rivet on slc5. I typed in the
>>>> command below.
>>>> 
>>>> *export
>>>> ATLAS_LOCAL_ROOT_BASE=/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase
>>>> <http://atlas.cern.ch/repo/ATLASLocalRootBase>
>>>> <http://atlas.cern.ch/repo/ATLASLocalRootBase>
>>>> source
>>>> /cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/user/atlasLocalSetup.sh
>>>> <http://atlas.cern.ch/repo/ATLASLocalRootBase/user/atlasLocalSetup.sh>
>>>> <http://atlas.cern.ch/repo/ATLASLocalRootBase/user/atlasLocalSetup.sh>
>>>> asetup 17.2.3.3,slc5
>>>> source
>>>> $SITEROOT/sw/lcg/external/MCGenerators_hepmc2.06.05/rivet/1.8.0.a/i686-slc5-gcc43-opt/rivetenv.sh*
>>> 
>>> That's probably not the best idea, since you're then setting up an ATLAS
>>> environment (which contains a Rivet version of its own) and then hoping
>>> that the rivetenv.sh won't spoil that environment. It might work for
>>> Rivet but I don't think running ATLAS commands would be safe anymore!
>>> 
>>> In fact, if you want this for ATLAS purposes then a better thing to do
>>> would be to call "asetup 19.0.1" which should automatically provide all
>>> the Rivet2 and YODA scripts, plus the ability to run it in Athena.
>>> 
>>>> the reason I want to use a new version of rivet is that I want to use
>>>> the efficiency function in YODA which I believe does’t exist in older
>>>> version.
>>> 
>>> Great, a real use-case ;-)  Please let us know if you need any help with
>>> this, or want to suggest improvements!
>>> 
>>> Andy
>>> 
>>> 
>>>>> Hi Hao,
>>>>> 
>>>>> That build, as the path indicates, is just for our experimental
>>>>> pre-release testing. It was built on SLC6 and hence can only be used
>>>>> from SLC6. And anyway it is old and will be removed/replaced shortly:
>>>>> the current released version is 2.1.1.
>>>>> 
>>>>> The best way to use a pre-built up-to-date Rivet from AFS is to source
>>>>> it from a Genser repository at
>>>>> /afs/cern.ch/sw/lcg/external/MCGenerators_lcgcmt*
>>>>> <http://cern.ch/sw/lcg/external/MCGenerators_lcgcmt*>
>>>>> <http://cern.ch/sw/lcg/external/MCGenerators_lcgcmt*>
>>>>> 
>>>>> In particular, for SLC5 and Rivet 2.1.1 lcgcmt65 looks "good":
>>>>> 
>>>>> /afs/cern.ch/sw/lcg/external/MCGenerators_lcgcmt65/rivet/2.1.1/x86_64-slc5-gcc47-opt/rivetenv.sh
>>>>> <http://cern.ch/sw/lcg/external/MCGenerators_lcgcmt65/rivet/2.1.1/x86_64-slc5-gcc47-opt/rivetenv.sh>
>>>>> <http://cern.ch/sw/lcg/external/MCGenerators_lcgcmt65/rivet/2.1.1/x86_64-slc5-gcc47-opt/rivetenv.sh>
>>>>> 
>>>>> Andy
>>>>> 
>>>>> 
>>>>> On 28/04/14 17:42, Hao Liu wrote:
>>>>>> Dear Rivet experts,
>>>>>> 
>>>>>> I encountered some problem when I am trying to setup Rivet on
>>>>>> lxplus5 at
>>>>>> CERN.
>>>>>> 
>>>>>> I found that there is a 2.0 version rivet in our machine which is here:
>>>>>> 
>>>>>> */afs/cern.ch/sw/lcg/experimental/rivet/setup.sh
>>>>>> <http://cern.ch/sw/lcg/experimental/rivet/setup.sh>
>>>>>> <http://cern.ch/sw/lcg/experimental/rivet/setup.sh>
>>>>>> <http://cern.ch/sw/lcg/experimental/rivet/setup.sh>*
>>>>>> 
>>>>>> but after I sourced this setup file. When I typed into rivet —help, I
>>>>>> got the message below:
>>>>>> 
>>>>>> [hao at lxplus438 ~]$  rivet --help
>>>>>> *The rivet Python module could not be loaded: is your PYTHONPATH set
>>>>>> correctly?*
>>>>>> *
>>>>>> *
>>>>>> This version works fine on lxplus6 machine at CERN. I believe this has
>>>>>> something to do with the gcc version but I am not so sure.
>>>>>> 
>>>>>> Best,
>>>>>> Hao
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> _______________________________________________
>>>>>> Rivet mailing list
>>>>>> Rivet at projects.hepforge.org <mailto:Rivet at projects.hepforge.org>
>>>>>> <mailto:Rivet at projects.hepforge.org>
>>>>>> https://www.hepforge.org/lists/listinfo/rivet
>>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Dr Andy Buckley, Royal Society University Research Fellow
>>>>> Particle Physics Expt Group, University of Glasgow / PH Dept, CERN
>>>> 
>>> 
>>> 
>>> -- 
>>> Dr Andy Buckley, Royal Society University Research Fellow
>>> Particle Physics Expt Group, University of Glasgow / PH Dept, CERN
>> 
> 
> 
> -- 
> Dr Andy Buckley, Royal Society University Research Fellow
> Particle Physics Expt Group, University of Glasgow / PH Dept, CERN



More information about the Rivet mailing list