This banner placeholder was generated by Gemini 3 Banana Pro using already made asset like the pixi, apptainer and singularity logo
Pixi is a fast, easy and fun to use tool that allows you to manage multiple dependencies in multiple environment very easily. It has a great support either by its developers or community on discord.
Singularity/Apptainer is very used in bioinformatics, it's at the hearth of analyzes pipelines, but it's a headache to put in place. In another hand, pixi is fast, easy to use, but it's not a container and so harder to keep intact for a long period of time. The idea behind pixitainer is to put a pixi environment into an Apptainer container, so you can freeze your fast pace working environment into a container easily !
Apptainer is more the "public library" version of the software, while Singularity is more like a "corporate bookstore." Because Apptainer is hosted by the Linux Foundation, it is designed specifically for the scientific community to ensure that your research code remains free, accessible and without being tied to a private company’s profit goals.
The best thing to do will be to add this way as a pixi extension, so we just have to type pixi containerize, some option and tada !
TODO:
- Receipe that works.
- Pixi package that I can add as an extension.
- Adding options to the extension.
- Build options
- Output image path (
-o,--output) - Working directory (
-p,--path) - Enable seamless execution (
-s,--seamless) - Specific environment selection (
-e,--env) - Verbose mode (
-v,--verbose) - Quiet mode (
-q,--quiet) - Specify base image (
--base-image) - Specify pixi version (
--pixi-version) - Add extra files/folders (
--add-file) - Export the
.deffile (--keep-def) - No installation of environment in the container (
--no-install)
- Output image path (
- Build options
- Support of container solutions
- Apptainer
- Singularity
- Docker
Note that by default pixitainer is made with Apptainer in mind so it will be an option to install other container solutions.
- Testings.
- Publish
- Go back to step 3 until WW3, messiah or death of the internet
- Install pixi
curl -fsSL https://pixi.sh/install.sh | shInstall pixitainer globaly on pixi:
pixi global install -c https://prefix.dev/raphaelribes -c https://prefix.dev/conda-forge pixitainer- Clone this repo
git clone https://github.com/RaphaelRibes/pixitainer.git
cd pixitainer- Build the pixitainer extension
pixi run build_all- Install the pixitainer extension
pixi global install pixitainer --channel $(pwd -P)/output --channel conda-forgeYou actually have two ways of using pixitainer:
- Manually
- Seamlessly
We put ourselves in an environment with one task defined like
[tasks]
make_dir = 'mkdir testdir'You can also build the container manually with apptainer
pixi containerizeThen you can use pixi in your image
apptainer run -f pixitainer.sif pixi run --as-is -m /opt/conf/pixi.toml make_dirWe add --as-is to make sure it sticks to the pixi.lock file and it only uses the installed binaries and doesn't try to install others.
WARNING:
-m /opt/conf/pixi.tomlis mandatory or pixi will use the default one in your current working directory.
Just use the pixitainer extension command after installing it with the seamless option (-s, --seamless).
pixi containerize -sYou can then turn your task like pixi is not even here
apptainer run -f pixitainer.sif make_dirWARNING: the seamless mode makes that every commands run through the image are ran like so
pixi run --as-is -m /opt/conf/pixi.toml "$@"Meaning that you only have access to
pixi runand nothing else.
When launching a command in the pixi shell, the cwd of tasks will be changed into the one of the pixi workplace (PIXI_PROJECT_ROOT).
Let's create a task
[tasks]
make_dir = 'mkdir testdir'If you run this task, it's going to create $PIXI_PROJECT_ROOT/testdir (/opt/conf/testdir) and not $INIT_CWD/testdir ($(pwd)/testdir).
What you want is to run pixi in the INIT_CWD so take the time to change your ./something to $INIT_CWD/something.
This is related to the previous problem: pixi is using PIXI_PROJECT_ROOT as the cwd.
It's going to try to write in /opt/conf wich is not allowed because the sif image is in read only.
To fix it, replace your mkdir test byt mkdir $INIT_CWD/test.
However, sometimes pixi may write something in its cache so don't hesitate to use --writable-tmpfs.