Error with lhapdf and python

Asked by Liliana on 2021-02-14

Hello, whenever I try to run a process Im getting this error

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 theLHAPDF library location to LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (mac os x). The required LD_LIBRARY_PATH is /home/lilianaqz/Desktop/MG5_aMC_v2_8_2/HEPTools/lhapdf6_py3/lib

I checked the file mg5_configuration.txt and it says this

#! lhapdf-config --can be specify differently depending of your python version
#! If None: try to find one available on the system
# lhapdf_py2 = lhapdf-config
lhapdf_py3 = /home/lilianaqz/Desktop/MG5_aMC_v2_8_2/HEPTools/lhapdf6_py3/bin/lhapdf-config #

I have searched in other posts but I havent found anything and dont really understand what the issue is and what can I do about it.

thanks :)

Question information

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

What is your OS?

Did you setup LD_LIBRARY_PATH?

On ubuntu 20, you have to setup LD_LIBRARY_PATH since the os prevent us to do that for you.

Cheers,

Olivier

> On 14 Feb 2021, at 22:35, Liliana <email address hidden> wrote:
>
> New question #695536 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/695536
>
> Hello, whenever I try to run a process Im getting this error
>
> 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 theLHAPDF library location to LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (mac os x). The required LD_LIBRARY_PATH is /home/lilianaqz/Desktop/MG5_aMC_v2_8_2/HEPTools/lhapdf6_py3/lib
>
> I checked the file mg5_configuration.txt and it says this
>
> #! lhapdf-config --can be specify differently depending of your python version
> #! If None: try to find one available on the system
> # lhapdf_py2 = lhapdf-config
> lhapdf_py3 = /home/lilianaqz/Desktop/MG5_aMC_v2_8_2/HEPTools/lhapdf6_py3/bin/lhapdf-config #
>
> I have searched in other posts but I havent found anything and dont really understand what the issue is and what can I do about it.
>
> thanks :)
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Liliana (liliana24) said : #3

Hi Im using Ubuntu 20.04.2. Can you tell me how to setup LD_LIBRARY_PATH? I have found different ways to do so on the internet but dont know which one is correct.

You actually have plenty of different method to do it and some of the method depend of the os/shell that you are using.
Since I do not have an ubuntu 20 machine, I'm not fully sure what is the best for you.

I would say that in general you have to edit the file
~/.bashrc
and include the line
export LD_LYBRARY_PATH=$LD_LYBRARY_PATH:/home/lilianaqz/Desktop/MG5_aMC_v2_8_2/HEPTools/lhapdf6_py3/lib

after that you can create a new terminal and check if it works by doing
echo $LD_LYBRARY_PATH

If you are not running bash but zsh then you need to edit ~/.zshrc

Cheers,

Olivier

> On 14 Feb 2021, at 23:01, Liliana <email address hidden> wrote:
>
> Question #695536 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/695536
>
> Liliana posted a new comment:
> Hi Im using Ubuntu 20.04.2. Can you tell me how to setup
> LD_LIBRARY_PATH? I have found different ways to do so on the internet
> but dont know which one is correct.
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Liliana (liliana24) said : #5

Hi Olivier I did that and checked it

lilianaqz@ubuntu:~$ echo $LD_LYBRARY_PATH
:/home/lilianaqz/Desktop/MG5_aMC_v2_8_2/HEPTools/lhapdf6_py3/lib

but I still get the same error, hope you can tell what the problem might be.

Liliana.

It is

LIBRARY_PATH not LYBRARY_PATHH

Cheers,

Olivier

> On 15 Feb 2021, at 01:20, Liliana <email address hidden> wrote:
>
> Question #695536 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/695536
>
> Status: Answered => Open
>
> Liliana is still having a problem:
> Hi Olivier I did that and checked it
>
> lilianaqz@ubuntu:~$ echo $LD_LYBRARY_PATH
> :/home/lilianaqz/Desktop/MG5_aMC_v2_8_2/HEPTools/lhapdf6_py3/lib
>
>
> but I still get the same error, hope you can tell what the problem might be.
>
> Liliana.
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Liliana (liliana24) said : #7

Thanks Olivier Mattelaer, that solved my question.