lhe_parser import failure

Asked by Andrin Kessler on 2019-11-14

Dear all,

I am running MG5_aMC v2.6.7 to generate events of the kind p p > Z [QCD]. This works fine and I seem to get sensible events (events_lhe file) in the "Events/run_01_LO " directory of my process.
Now I would like to use the virt_reweighter.py script to consider the one-loop corrections of the process. Unfortunately, I get an import error (no module named ... )when the script tries to exectue "import madgraph.various.lhe_parser". This seems very weird to me since MG5 probably used the lhe_parser already to create the event file in the first place so the module should be available on my system somewhere (I might very well be wrong on this).
To me, this seems to be some kind of Pythonpath problem that I am not able to resolve but probably is quite trivial. I am running python 2.7 in a venv equipped with lhapdf, numpy and the likes which all worked fine up to now. I am also executing MG5 from within this venv.
I checked sys.path both in its initial state and after doing the same path alterations the script does before importing the module. Amongst the usual and the paths appended by the script there is the path to the current directory (... processDir/bin/internal ) which is also the location of the scirpt lhe_parser.py which I would have naively expected to be the one python is looking for.

Unfortunately, I am not the most adept linux or MG5 user and at this point I am stuck.
I am very grateful for any advice on this issue.

Thank you very much,
Andrin

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Olivier Mattelaer
Solved:
2019-11-15
Last query:
2019-11-15
Last reply:
2019-11-14

Hi,

Since this is
import madgraph.various.lhe_parser

This means that script need to be run with the full madgraph linked and not the version within bin/internal.
So you have to include in your PYTHONPATH the path for madgraph.
(or change the line
import madgraph.various.lhe_parser
to
import lhe_parser
or better
try:
    import madgraph.various.lhe_parser
except ImportError
   import internal.lhe_parser

Cheers,

Olivier

Andrin Kessler (nirdna) said : #2

Thanks a lot! With your help I was able to resolve this and all related issues.

Cheers,
Andrin

Andrin Kessler (nirdna) said : #3

Thanks Olivier Mattelaer, that solved my question.