Failed to access python version of LHAPDF

Asked by Alberto Rescia on 2020-12-01


When launching a run in MadGraph5, the following error appears:

"Failed to access python version of LHAPDF: If the python interface to LHAPDF is available on your system, try adding its location to the PYTHONPATH environment variable and the LHAPDF library location to LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (mac os x). The required LD_LIBRARY_PATH is /afs/".

I am working on lxplus7, so CentOS7.

I've tried following previous advice found at , so I've already ensured that I've added lhapdf6_py3/lib to my LD_LIBRARY_PATH. I've also tried exporting the directory HEPTools/bin/python3.6 (which I suppose contains the version of python I would like to access) to my PYTHONPATH, to no avail. Adding the compatible version of Python3.6 offered in the lcg release also does not work.

How can I resolve this issue? I am not an expert so thank you for your help.

Question information

English Edit question
MadGraph5_aMC@NLO Edit question
No assignee Edit question
Last query:
Last reply:


I have a couple of questions:
- Which version of python3 are you using? (python3 --version)
- are you running ./bin/mg5_aMC or do you use a wrapper around that executable (in that case please check the python version used to run MG5aMC)
- HEPTools/bin/python3.6 this path sounds really weird this path seems wrong
- Do you have the following directory: HEPTools/lhapdf6_py3/lib/python3.6
(replace python3.6 by the one corresponding to the python version that you are effectively using)



Alberto Rescia (arescia) said : #2

Dear Olivier,

I am using Python 3.6.8 and I am running ./bin/mg5_aMC. You're right about the path - I confused bin for lib, so the python 3.6 directory is found in HEPTools/lib/python3.6. However, I also have HEPTools/lhapdf6_py3/lib64/python3.6.

Thanks again for your help.



Then the first things to check is the following:
1) setup your environment as for the mG5amc run ( LD_LIBRARY_PATH and PYTHONPATH)
2) run your python versionn
3) type "import lhapdf"

and see if works or not.

if it does,
then this would be surprising
Do you have any environment variable related to lhapdf:
printenv | grep LHA



Alberto Rescia (arescia) said : #4


When I try to import lhapdf in the python3 shell, it does not work. I also do not have any environment variabile related to lhapdf.


Actually are you sure that your run python3.6?

MG5aMC should requires python3.7 as a minimum. (or 2.7)
I know that some CMS people hack MG5aMC to support python 3.6 but the official version does not support it.

>When I try to import lhapdf in the python3 shell, it does not work.

Good then this means that your installation of lhapdf is not setup for python3.6 ...
The best is likely to re-install lhapdf via "install lhapdf6" to be sure to use the same python version



Can you help with this problem?

Provide an answer of your own, or ask Alberto Rescia for more information if necessary.

To post a message you must log in.