This small definition file can be used to create a conda environment in an apptainer / singularity container.
Givent environment.yml is combined with the micromamba_apptainer.def
definition file to create a SIF-image:
graph TD;
E[environment.yml]-->S[my_environment.sif];
D[micromamba_apptainer.def]-->S[my_environment.sif];
Create a environment.yml file with all needed channels and dependencies
present. Name the environment base. This is important as all packages
will be installed to the base environment.
name: base
channels:
- conda-forge
dependencies:
- python
- numpyCreate an apptainer image with the bootstrapping definition.
For apptainer:
apptainer build my_environment.sif micromamba_apptainer.defYou can run python from the the image with apptainer run:
apptainer run my_environment.sif python -c 'import numpy as np; print(np.__version__)'apptainer run automatically activates the base-environment.
If you're using singularity, just swap apptainer to singularity in all commands.