Wave and Singularity

Hi all, I really enjoyed the summit and I am very happy we now have a community forum!

After having seen the wave-cli demo by @paolo, I have been experimenting a bit with it and, especially, singularity. I am using singularity-ce version 3.9.5.

As from the demo and the docs, I used the --singularity option freezing the image and specifying a build repo and that worked:

> singularity exec $(wave --conda-package star=2.4.0j --conda-package sambamba=0.7.1 --singularity --freeze --build-repo docker.io/emi80/wave-build --await) STAR --version
INFO:    Downloading oras image
INFO:    Converting SIF file to temporary sandbox...
STAR_2.4.0j
INFO:    Cleaning up image...

Then, I was wondering whether I could directly create a container from the image stored in the wave server (I know that the built images are cleaned up, but I think this could be useful for quick-building images or for on-prem wave servers):

> singularity exec docker://$(wave --conda-package star=2.4.0j --conda-package sambamba=0.7.1 --await) STAR --version
INFO:    Using cached SIF image
INFO:    Converting SIF file to temporary sandbox...
FATAL:   "STAR": executable file not found in $PATH
INFO:    Cleaning up image...

It almost worked but it seems like using the exec singularity command (mimicking Nextflow behavior) the tools are not found in $PATH. Using run would solve the issue as the micrimamba Docker image as a default SHELL command that configures the conda environment. Using the full path of the tools would work:

❯ singularity exec docker://$(wave --conda-package star=2.4.0j --conda-package sambamba=0.7.1 --await) /opt/conda/bin/STAR --version
INFO:    Using cached SIF image
INFO:    Converting SIF file to temporary sandbox...
STAR_2.4.0j
INFO:    Cleaning up image...

I was wondering whether this is a bug and, in case, if it could be fixed by:

  • prepending the image returned by Wave with docker:// when a singularity image is requested and thus not requiring a freeze

and either:

  • updating the micromamba Docker image to work with singularity exec
  • use singularity run in Nextflow (though this could possibly have an unexpected impact on existing pipelines)

P.S. Tried with singularity 4 and the --oci flag but AFAIU it still needs the docker:// prefix and does not help either:

❯ singularity exec --oci docker://$(wave --conda-package star=2.4.0j --conda-package sambamba=0.7.1  --await) STAR --version
INFO:    Using cached OCI-SIF image
2023-10-22T09:04:00.000543593Z: executable file `STAR` not found in $PATH: No such file or directory

Thanks!

It almost worked but it seems like using the exec singularity command (mimicking Nextflow behavior) the tools are not found in $PATH

Because the Singularity build exports the tool mamba bin path, while that’s not needed by Docker

Also local Singularity conversion is not a good idea for non-freezed containers because it can convert multiple times the same image just having a different name.

This will be addressed by the support for Singularity 4.

Thanks @paolo for the quick reply.

I see, so the same image but with a different name will have a different hash and would need to be reconverted since the “old” cache would not be valid…

Great! Any expected timeframe for that?

It should be pretty simple. You may expect it in the upcoming weeks. you can help us figure out why Singularity 4 image is not building GitHub - singularityhub/singularity-docker at v4.0.0

I updated the Dockerfile and now it builds.

GitHub - emi80/singularity-docker at v4.0.0 - it might need some clean-up but it works :partying_face:

I will make a PR to the original repo as well.

Awesome, well done!

(adding some random text otherwise the forum does not allow me to reply)

Hey @paolo!

Thanks to the fast response time of @vsoch we now have various singularity 4.0.1 Dockerfiles working for amd64 and arm.

Cheers!

Thanks Emilio! look into next step: