Skip to content

Instantly share code, notes, and snippets.

@npho
Created September 28, 2021 05:17
Show Gist options
  • Save npho/6de7dbcb59dcee47036e510659733089 to your computer and use it in GitHub Desktop.
Save npho/6de7dbcb59dcee47036e510659733089 to your computer and use it in GitHub Desktop.
How to build a Python conda environment in a Singularity container.
Bootstrap: docker
From: continuumio/miniconda3
%environment
export PATH=/opt/conda/bin:${PATH}
%files
compute.yml environment.yml
%post
/opt/conda/bin/conda env create -f environment.yml
%runscript
source /opt/conda/etc/profile.d/conda.sh
exec /opt/conda/envs/$(head -n 1 environment.yml | cut -f 2 -d ' ')/bin/"$@"
name: compute
channels:
- defaults
dependencies:
- pip=21.0.1=py38h06a4308_0
- python=3.8.11=h12debd9_0_cpython
- pip:
- ipython==7.12.0
- matplotlib==3.4.3
- numpy==1.21.2
- pandas==1.3.3
- scipy==1.7.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment