How do I add lhapdf to my image?

Images other than ATLAS releases

In general, it should be possible to install lhapdf onto a docker image following the installation instructions on the lhapdf webpage, then pdf sets can be downloaded from using the lhapdf command-line tool.

Eg. to download the NNPDF30_lo_as_0130 dataset:

lhapdf --source= get NNPDF30_lo_as_0130

ATLAS release images

However, this installation doesn’t seem to work in the atlas release images (eg. atlas/athanalysis), giving the following error message:

Unable to execute '/cvmfs/': No such file or directory

The atlas release image does come with its own lhapdf installation, but currently a few (rather kludgy) modifications are needed to get it working.

  1. There seems to be a buggy line in the lhapdf executable python script, which can be fixed as follows: replace line 17 in the lhapdf executable /usr/AthAnalysisExternals/21.2.115/InstallArea/x86_64-centos7-gcc8-opt/bin/lhapdf from
                         .replace('${datarootdir}', '${prefix}/share')\


    configured_datadir = configured_datadir.replace('${datarootdir}', '${prefix}/share')\
  1. Install the lhapdf python client locally:
pip install --user lhapdf
  1. Make the lhapdf directory containing the pdf set list pdfsets.index, config file lhapdf.conf and downloaded pdf sets writeable by all. Eg. for the atlas/athanalysis:21.2.115 container:
sudo chmod -R a+w /usr/AthAnalysisExternals/21.2.115/InstallArea/x86_64-centos7-gcc8-opt/share/LHAPDF 

It should now be possible to download pdf sets with the source url specified (otherwise it tries to look for them in cvmfs by default). Eg.

lhapdf --source= get NNPDF30_lo_as_0130
1 Like

Thanks very much for this post, @damacdon! It was helpful in giving some instructions for this Docker image. :+1:

Yippee!! Thanks for the feedback @feickert, I’m glad it could be of use to someone :sweat_smile:

1 Like

So as brought to my attention by Silvia Auricchio, this is still a problem in modern AnalysisBase images. I’ve learned that this is because LHAPDF_DATA_PATH is being set to that it assumes the user is on CVMFS (which is a bad assumption).

$ docker run --rm -ti atlas/analysisbase:21.2.164
             _ _____ _      _   ___ 
            /_\_   _| |    /_\ / __|
           / _ \| | | |__ / _ \\__ \
          /_/ \_\_| |____/_/ \_\___/

This is a self-contained ATLAS AnalysisBase image.
To set up the analysis release of the image, please

          source /

[bash][atlas]:workdir > . / 
Configured GCC from: /opt/lcg/gcc/8.3.0-cebb0/x86_64-centos7/bin/gcc
Configured AnalysisBase from: /usr/AnalysisBase/21.2.164/InstallArea/x86_64-centos7-gcc8-opt
[bash][atlas AnalysisBase-21.2.164]:workdir > echo "${LHAPDF_DATA_PATH}"
[bash][atlas AnalysisBase-21.2.164]:workdir > lhapdf ls
Could not open /cvmfs/

This can be avoided by removing the CVMFS component from the path

[bash][atlas AnalysisBase-21.2.164]:workdir > export LHAPDF_DATA_PATH="${LHAPDF_DATA_PATH#*:}"
[bash][atlas AnalysisBase-21.2.164]:workdir > echo "${LHAPDF_DATA_PATH}"
[bash][atlas AnalysisBase-21.2.164]:workdir > lhapdf ls | grep NNPDF23_lo_as_0130_qed

but this is not a very good fix in general. This should probably be reported to the AnalysisBase Docker image maintainers.