Geant4Py Singularity install error

Hello Experts,

I’ve been trying to install the Geant4(10.7.2) on the Singularity (based on ubuntu20.04) but failed when turn on the python support. It stops at the CMake stage with the following message:

cmake -DCMAKE_INSTALL_PREFIX=/opt/geant4/install -DGEANT4_INSTALL_DATA=ON -DGEANT4_INSTALL_DATADIR=/opt/geant4/data -DGEANT4_USE_QT=ON -DGEANT4_BUILD_TLS_MODEL=global-dynamic -DGEANT4_USE_PYTHON=ON …/src/geant4.10.07.p02

– Found PythonInterp: /bin/python3 (found suitable version “3.8.5”, minimum required is “3.0”)
– Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.8.so (found version “3.8.5”)
– Found Boost: /lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake (found suitable version “1.71.0”, minimum required is “1.65”) found components: python
– The following Geant4 features are enabled:
GEANT4_BUILD_CXXSTD: Compiling against C++ Standard ‘11’
GEANT4_USE_SYSTEM_EXPAT: Using system EXPAT library
GEANT4_USE_PYTHON: Building bindings for Python 3.8

– Configuring done
CMake Error in environments/g4py/source/global/CMakeLists.txt:
Imported target “Boost::python” includes non-existent path

"/include"

in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

  • The path was deleted, renamed, or moved to another location.

  • An install or uninstall procedure did not complete successfully.

  • The installation package was faulty and references files it does not
    provide.

It works fine without the python support. I also tried to install with the same settings when I run the Singularity with shell, and install from there, it’s also okay. So, there must be something not correct in the Singularity build.

Just for the reference, I also printed out the ENV from Singularity build as well as from interactive shell in the image to compare:

Message from the Singularity build:

  • printenv
    USER=root
    BOOTSTRAP=docker
    SINGULARITY_CHECKLEVEL=3
    SHLVL=1
    HOME=/root
    OLDPWD=/
    SINGULARITY_BUILDDEF=Singularity
    SINGULARITY_CHECKTAGS=bootstrap
    SINGULARITY_version=2.6.1-dist
    SINGULARITY_ENVIRONMENT=/.singularity.d/env/91-environment.sh
    SINGULARITY_MESSAGELEVEL=1
    _=/sbin/chroot
    SINGULARITY_libexecdir=/usr/lib/x86_64-linux-gnu
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
    SINGULARITY_DEFFILE_FROM=rootproject/root:6.24.00-ubuntu20.04
    SINGULARITY_CHECKS=no
    LANG=C
    SINGULARITY_IMAGE=/tmp/.singularity-build.vWJVay
    FROM=rootproject/root:6.24.00-ubuntu20.04
    SINGULARITY_DEFFILE_BOOTSTRAP=docker
    DEBIAN_FRONTEND=noninteractive
    SINGULARITY_bindir=/usr/bin
    SINGULARITY_ROOTFS=/var/lib/singularity/mnt/container
    PWD=/opt/geant4/build

Message from the shell within the Singularity session:
printenv

SHELL=/bin/bash
SINGULARITY_NAME=raser.simg
CLING_STANDARD_PCH=none
PWD=/opt/geant4/build
HOME=/root
LANG=C.UTF-8
SINGULARITY_CONTAINER=raser.simg
PYTHONPATH=/opt/root/lib:
TERM=xterm-256color
SHLVL=1
ROOTSYS=/opt/root
LD_LIBRARY_PATH=/.singularity.d/libs
PS1=Singularity raser.simg:\w>
PATH=/opt/root/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
OLDPWD=/root
_=/usr/bin/printenv

Any suggestion?

Thank you!

Xin

This looks to be a fundamental bug in the install of Boost or the container. The error:

CMake Error in environments/g4py/source/global/CMakeLists.txt:
Imported target “Boost::python” includes non-existent path

"/include"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:

The path was deleted, renamed, or moved to another location.

An install or uninstall procedure did not complete successfully.

The installation package was faulty and references files it does not
provide.

suggests that the file /lib/x86_64-linux-gnu/cmake/Boost-1.71.0/BoostConfig.cmake isn’t setting up the paths to the headers correctly. Looking at the contents of the Ubuntu 20.04 package for Boost-dev:

https://packages.ubuntu.com/focal/amd64/libboost1.71-dev/filelist

it looks like the package is installed in the wrong place - it should be under /usr not /. I’m not familiar enough with Singularity to know if this is a setup issue with your instance, or if the underlying container is buggy.

Hi Benjamin,

Thanks for your quick reply!

Here is a compromised solution which works now (the Geant4 is installed in the $HOME area not in the container itself) You can find the related scripts at:

The install of Geant4 with Python3 support is done by:

./sinularity_build.sh
./singularity_run.sh (get into the container shell)
raser> geant4_build.sh

However, once we add the similar command from geant4_build.sh into the Singularity build (replacing the $HOME with /opt) it will show the error as posted in the beginning.

Hope that helps.

Xin

I’m not sure I can be of much help here - the fundamental issue is either with the Docker container the Singularity one is based on, or something in the Singularity script/local setup is incorrect. The solution is to understand why in your environment/scripts packages are getting installed (or CMake thinks they are) in / rather than /usr.

Thanks. I’ll just leave it there for the moment unless some one with experience of Singularity could help. …