Closed ylep closed 1 year ago
Yet another fork... Is there an easy way to detect whether we are running singularity or apptainer ? (actually I failed to install apptainer on an Ubuntu 18.04 system: the .deb depends on fuse-overlayfs, which does not seem to exist in ubuntu 18 repositories, and the PPA doesn't work either on this system).
Are the messages still displayed if two variables are defined per value (one with prefix SINGULARITYENV_
and the other with APPTAINERENV_
) ? If not, this may be a solution.
Are the messages still displayed if two variables are defined per value (one with prefix
SINGULARITYENV_
and the other withAPPTAINERENV_
) ? If not, this may be a solution.
Good idea, but it does not work; it actually produces a stronger warning:
WARNING: Skipping environment variable [SINGULARITYENV_CASA_SYSTEM=ubuntu-22.04], CASA_SYSTEM is already overridden with different value [toto]
Is there an easy way to detect whether we are running singularity or apptainer ?
Yes, singularity --version
gives e.g. apptainer version 1.1.5
. I was thinking to use this in order to switch to SINGULARITYENV_
or APPTAINERENV_
automatically.
It complains because you seem to have different values in SINGULARITYENV_
and APPTAINERENV_
variables, right ? If the value is actually the same, does it also complain ?
Otherwise, OK to test singularity
version.
When values are the same, it seems not to complain (tried on alambic), so this may be a workaround for now.
But otherwise, testing singularity version is OK (it will run the singularity
command once more). We could also test if the apptainer
command is available in the PATH
(but this is possibly longer) and use it if it is here, which would free us from the apptainer installation link singularity -> apptainer
.
On my installation (apptainer 1.1.5) it does complain when both are set to the same value, the message is actually the same as if the APPTAINERENV_
variable were not set:
INFO: Environment variable SINGULARITYENV_CASA_SYSTEM is set, but APPTAINERENV_CASA_SYSTEM is preferred
Therefore, i believe we need to:
apptainer
command exists, and if so, call it and change all variables to APPTAINERENV_
singularity
command and SINGULARITYENV_
variables as usualWe do not even need to run singularity --version
, just to test for which executable to call (find_executable
or shutil.which
).
I will try to implement this fix today.
casa-distro works with apptainer as of now (tested with apptainer 1.1.5) because apptainer includes a
singularity -> apptainer
symbolic link, and it also understandsSINGULARITY*
environment variables. However, such compatibility may be dropped in the future, and theSINGULARITYENV_*
variables generate warnings at runtime.Therefore, to improve user experience with Apptainer we should detect if we are running under Singularity or Apptainer, and set the variables appropriately.