Madgraph keeps asking for lhapdf-config path

Asked by Isaac Wang

Maybe it's a naive question but it just makes me very confused.

I have setup the lhapdf path by set lhapdf /Path/to/lhapdf-config with the correct path.

But every time when I start MG5 it gives me this:
```
set lhapdf to /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config
None does not seem to correspond to a valid lhapdf-config executable.
Please set the 'lhapdf' variable to the (absolute) /PATH/TO/lhapdf-config (including lhapdf-config).
Note that you can still compile and run aMC@NLO with the built-in PDFs
 MG5_aMC> set lhapdf /PATH/TO/lhapdf-config
```

The path mentioned in the first line is valid.

I opened the configuration file, and it says
```
! 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 = lhapdf-config
lhapdf = /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config
```

It seems lhapdf is successfully set up.
Then I really don't understand.

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Olivier Mattelaer
Solved:
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Hi,

Which version of MG5aMC are you using? I do not remember anything recent related to lhapdf within any of the supported version but this might still be useful to know.

I have check the code from 3.5.3:
https://github.com/mg5amcnlo/mg5amcnlo/blob/59b4b9c1238978f39a32b8bc83244328187704b6/madgraph/interface/madgraph_interface.py#L7982

So it seems that the command
/Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config --version
is crashing in one way or another (it the sense that the return code is not zero)

Can you check what the command print on screen and what is the associated return code (echo $?)

Now, I have to admit that I do not understand why args[1] is printed as /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config in the first printout but as "None" in the second ... This does not make sense to me. Maybe your version does not have the exact same line which might then explain this (or I just miss something obviously)

Cheers,

Olivier

Revision history for this message
Isaac Wang (isaac95) said :
#2

Hi, I'm using MG5 3.5.0, with python 3.10.

I run /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config --version, and it prints
6.5.4

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#3

and the return code is zero?

Revision history for this message
Isaac Wang (isaac95) said :
#4

```sh
 /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config --version
6.5.4

echo $?
0
```

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#5

Do you need the "sh"? If you do it means that you have a permission issue on lhapdf-config (we do assume that such file is executable).

Can you also try to run the following (within MG5aMC command line interface)
set lhapdf /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config
to see if that way it works or not ( I would bet that not...)

And if not, then the only option is likely to edit the code, to add more print statement.
SO change the above code (so madgraph/interface/madgraph_interface.py around line 7981) to

                try:
                    res = misc.call([args[1], '--version'], stdout=subprocess.PIPE,
                                                                 stderr=subprocess.PIPE)
                    logger.info('set lhapdf to %s' % args[1])
                    self.options['lhapdf'] = args[1]
                    self.options[args[0]] = args[1]
                    print("lhapdf did work return code was ", res)
                except Exception as error:
                    print("code fails with ", error)
                    print("args is ", args)
                    res = 1
                if res != 0:
                    logger.info('%s does not seem to correspond to a valid lhapdf-config ' % args[1] + \
                            'executable. \nPlease set the \'lhapdf\' variable to the (absolute) ' + \
                            '/PATH/TO/lhapdf-config (including lhapdf-config).\n' + \
                            'Note that you can still compile and run aMC@NLO with the built-in PDFs\n' + \
                            ' MG5_aMC> set lhapdf /PATH/TO/lhapdf-config\n')

Revision history for this message
Isaac Wang (isaac95) said :
#6

Hi,

No, I did not need 'sh'. I just wrote it around "```" to show that the following are the shell commands and outputs.

Actually, the way I defined the lhapdf path in MG5 was exactly the command "set lhapdf xxxxx". And MG5 told me that it works. And I could see that the .txt configuration file was indeed written. But the next time I started MG5, the problem appeared as I described in the main text of this problem page. I manually uninstall MG5 and re-install and retry, everything remains the same.

I tried your suggestions as follows. I first completely remove the lhapdf set in the configuration .txt file. Then in MG5 command line, I do the following:
```
MG5_aMC>set lhapdf /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config
set lhapdf to /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config
lhapdf did work return code was 0
save options lhapdf
save configuration file to /Users/quarkquartet/Work/MG5_aMC_v3_5_0/input/mg5_configuration.txt
```

Then I quit MG5, restart MG5, it gives me this:

```
set lhapdf to /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config
lhapdf did work return code was 0
code fails with ['./None', '--version'] fails with no such file or directory
args is ['lhapdf_py3', 'None', '--no_save']
None does not seem to correspond to a valid lhapdf-config executable.
```

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#7

Could you check if you have a line
lhapdf_py3 = None
later in your configuration file?

This might be the reason of the issue.

Revision history for this message
Isaac Wang (isaac95) said :
#8

No, there is no such a line.

Whole file is here.

################################################################################
#
# Copyright (c) 2009 The MadGraph5_aMC@NLO Development team and Contributors
#
# This file is a part of the MadGraph5_aMC@NLO project, an application which
# automatically generates Feynman diagrams and matrix elements for arbitrary
# high-energy processes in the Standard Model and beyond.
#
# It is subject to the MadGraph5_aMC@NLO license which should accompany this
# distribution.
#
# For more information, visit madgraph.phys.ucl.ac.be and amcatnlo.web.cern.ch
#
################################################################################
#
# This File contains some configuration variable for MadGraph/MadEvent
#
# Line starting by #! are comment and should remain commented
# Line starting with # should be uncommented if you want to modify the default
# value.
# Current value for all options can seen by typing "display options"
# after either ./bin/mg5_aMC or ./bin/madevent
#
# You can place this files in ~/.mg5/mg5_configuration.txt if you have more than
# one version of MG5.
#
################################################################################

#! Allow/Refuse syntax that changed meaning in version 3.1 of the code
#! (Compare to 3.0, 3.1 is back to the meaning of 2.x branch)
#!
# acknowledged_v3.1_syntax = False

#! Prefered Fortran Compiler
#! If None: try to find g77 or gfortran on the system
#!
# fortran_compiler = None
# f2py_compiler_py2 = None
# f2py_compiler_py3 = None

#! Prefered C++ Compiler
#! If None: try to find g++ or clang on the system
#!
# cpp_compiler = None

#! Prefered Text Editor
#! Default: use the shell default Editor
#! or try to find one available on the system
#! Be careful: Only shell based editor are allowed
text_editor = nvim #

#! Prefered WebBrower
#! If None: try to find one available on the system
# web_browser = None

#! Prefered PS viewer
#! If None: try to find one available on the system
# eps_viewer = None

#! Time allowed to answer question (if no answer takes default value)
#! 0: No time limit
# timeout = 60

#! Pythia8 path.
#! Defines the path to the pythia8 installation directory (i.e. the
#! on containing the lib, bin and include directories) .
#! If using a relative path, that starts from the mg5 directory
pythia8_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #

#! MG5aMC_PY8_interface path
#! Defines the path of the C++ driver file that is used by MG5_aMC to
#! steer the Pythia8 shower.
#! Can be installed directly from within MG5_aMC with the following command:
#! MG5_aMC> install mg5amc_py8_interface
# mg5amc_py8_interface_path = ./HEPTools/MG5aMC_PY8_interface

#! Herwig++/Herwig7 paths
#! specify here the paths also to HepMC ant ThePEG
#! define the path to the herwig++, thepeg and hepmc directories.
#! paths can be absolute or relative from mg5 directory
#! WARNING: if Herwig7 has been installed with the bootstrap script,
#! then please set thepeg_path and hepmc_path to the same value as
#! hwpp_path
hwpp_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #
thepeg_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #
hepmc_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #

#! Control when MG5 checks if he is up-to-date.
#! Enter the number of day between two check (0 means never)
#! A question is always asked before any update
auto_update = 7 #

################################################################################
# INFO FOR MADEVENT / aMC@NLO
################################################################################
# If this file is in a MADEVENT Template. 'main directory' is the directory
# containing the SubProcesses directory. Otherwise this is the MadGraph5_aMC@NLO main
# directory (containing the directories madgraph and Template)

#! Allow/Forbid the automatic opening of the web browser (on the status page)
#! when launching MadEvent [True/False]
# automatic_html_opening = True
#! allow notification of finished job in the notification center (Mac Only)
# notification_center = True

#! Default Running mode
#! 0: single machine/ 1: cluster / 2: multicore
# run_mode = 2

#! Cluster Type [pbs|sge|condor|lsf|ge|slurm|htcaas|htcaas2] Use for cluster run only
#! And cluster queue (or partition for slurm)
#! And size of the cluster (some part of the code can adapt splitting accordingly)
# cluster_type = condor
# cluster_queue = madgraph
# cluster_size = 150

#! Path to a node directory to avoid direct writing on the central disk
#! Note that condor clusters avoid direct writing by default (therefore this
#! options does not affect condor clusters)
# cluster_temp_path = None

#! path to a node directory where local file can be found (typically pdf)
#! to avoid to send them to the node (if cluster_temp_path is on True or condor)
# cluster_local_path = None # example: /cvmfs/cp3.uclouvain.be/madgraph/

#! Cluster waiting time for status update
#! First number is when the number of waiting job is higher than the number
#! of running one (time in second). The second number is in the second case.
# cluster_status_update = 600 30

#! How to deal with failed submission (can occurs on cluster mode)
#! 0: crash, -1: print error, hangs the program up to manual instructions, N(>0) retry up to N times.
# cluster_nb_retry = 1

#! How much time to wait for the output file before resubmission/crash (filesystem can be very slow)
# cluster_retry_wait = 300

#! Nb_core to use (None = all) This is use only for multicore run
#! This correspond also to the number core used for code compilation for cluster mode
# nb_core = None

#! Pythia-PGS Package
#! relative path start from main directory
pythia-pgs_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #

#! Delphes Package
#! relative path start from main directory
delphes_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #

#! MadAnalysis4 fortran-based package [for basic analysis]
#! relative path start from main directory
madanalysis_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #

#! MadAnalysis5 python-based Package [For advanced analysis]
#! relative path start from main directory
madanalysis5_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #

#! ExRootAnalysis Package
#! relative path start from main directory
exrootanalysis_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #

#! TOPDRAWER PATH
#! Path to the directory containing td executables
#! relative path start from main directory
td_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #

#! 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

#! fastjet-config
#! If None: try to find one available on the system
# fastjet = fastjet-config

#! eMELA-config
#! If None: try to find one available on the system
# eMELA = eMELA-config

#! MCatNLO-utilities
#! relative path starting from main directory
# MCatNLO-utilities_path = ./MCatNLO-utilities

#! Set what OLP to use for the loop ME generation
# OLP = MadLoop

#! Set the PJFRy++ directory containing pjfry's library
#! if auto: try to find it automatically on the system (default)
#! if '' or None: disabling pjfry
#! if pjfry=/PATH/TO/pjfry/lib: use that specific installation path for PJFry++
# pjfry = auto

#! Set the Golem95 directory containing golem's library
#! It only supports version higher than 1.3.0
#! if auto: try to find it automatically on the system (default)
#! if '' or None: disabling Golem95
#! if golem=/PATH/TO/golem/lib: use that speficif installation path for Golem95
# golem = auto

#! Set the samurai directory containing samurai's library
#! It only supports version higher than 2.0.0
#! if auto: try to find it automatically on the system (default)
#! if '' or None: disabling samurai
#! if samurai=/PATH/TO/samurai/lib: use that specific installation path for samurai
# samurai = None

#! Set the Ninja directory containing ninja's library
#! if '' or None: disabling ninja
#! if ninja=/PATH/TO/ninja/lib: use that specific installation path for ninja
# ninja = ./HEPTools/lib

#! Set the COLLIER directory containing COLLIER's library
#! if '' or None: disabling COLLIER
#! if ninja=/PATH/TO/ninja/lib: use that specific installation path for COLLIER
# Note that it is necessary that you have generated a static library for COLLIER
# collier = ./HEPTools/lib

#! Set how MadLoop dependencies (such as CutTools) should be handled
#! > external : ML5 places a link to the MG5_aMC-wide libraries
#! > internal : ML5 copies all dependencies in the output so that it is independent
#! > environment_paths : ML5 searches for the dependencies in your environment path
# output_dependencies = external

#! SysCalc PATH
#! Path to the directory containing syscalc executables
#! relative path start from main directory
syscalc_path = /Users/quarkquartet/Work/DM-enc-chiSb/MG5-SM-bbh/None #

#! Absolute paths to the config script in the bin directory of PineAPPL
#! (to generate PDF-independent fast-interpolation grids).
# pineappl = pineappl

mg5_path = /Users/quarkquartet/Work/MG5_aMC_v3_5_0

# MG5 MAIN DIRECTORY
mg5_path = /Users/quarkquartet/Work/MG5_aMC_v3_5_0

# MG5 MAIN DIRECTORY
mg5_path = /Users/quarkquartet/Work/MG5_aMC_v3_5_0

# MG5 MAIN DIRECTORY
mg5_path = /Users/quarkquartet/Work/MG5_aMC_v3_5_0
lhapdf = /Users/quarkquartet/Work/local/lhapdf6/bin/lhapdf-config

# MG5 MAIN DIRECTORY
mg5_path = /Users/quarkquartet/Work/MG5_aMC_v3_5_0

Revision history for this message
Best Olivier Mattelaer (olivier-mattelaer) said :
#9

Ok,

Thanks, now I was able to reproduce the bug and therefore fix it:
https://github.com/mg5amcnlo/mg5amcnlo/commit/eebeccc45d1f4a12f816d860ff446e1270f6b32c

Thanks so much for your patience and your help on this,

Cheers,

Olivier

Revision history for this message
Isaac Wang (isaac95) said :
#10

OK that solved the issue. Thank you!