rsnt_translations
56,420
edits
No edit summary |
(Marked this version for translation) |
||
Line 408: | Line 408: | ||
==Using Conda in Apptainer == <!--T:112--> | ==Using Conda in Apptainer == <!--T:112--> | ||
<!--T:144--> | |||
We will preface this tutorial on how to use Conda inside a container with the following '''important notes''': | We will preface this tutorial on how to use Conda inside a container with the following '''important notes''': | ||
<!--T:145--> | |||
#Even inside a container, Conda should be used only as a '''last resort'''. Priority should always be given to using [[Modules|modules]] from our [[Available_software|software stack]], and [[Python|wheels]] from our [[Available_Python_wheels|Python wheelhouse]]. These are optimized for our systems and we are better equipped to provide support if you use them. Please contact us if you need a module or a Python package that is not currently available on our systems. | #Even inside a container, Conda should be used only as a '''last resort'''. Priority should always be given to using [[Modules|modules]] from our [[Available_software|software stack]], and [[Python|wheels]] from our [[Available_Python_wheels|Python wheelhouse]]. These are optimized for our systems and we are better equipped to provide support if you use them. Please contact us if you need a module or a Python package that is not currently available on our systems. | ||
#This tutorial will use the [https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html micromamba] package manager instead of Conda. If you choose to use Conda instead, keep in mind that its use is subject to [https://legal.anaconda.com/policies/en?name=terms-of-service#terms-of-service Anaconda's Terms of Service] and might require a [https://www.anaconda.com/pricing/terms-of-service-faqs commercial license]. | #This tutorial will use the [https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html micromamba] package manager instead of Conda. If you choose to use Conda instead, keep in mind that its use is subject to [https://legal.anaconda.com/policies/en?name=terms-of-service#terms-of-service Anaconda's Terms of Service] and might require a [https://www.anaconda.com/pricing/terms-of-service-faqs commercial license]. | ||
#This tutorial shows how to create a read-only image, i.e., a one-off <tt>.sif</tt> file containing a Conda environment that has everything you need to run your application. We strongly discourage installing software interactively with Conda inside a container and will not show how to do this here. | #This tutorial shows how to create a read-only image, i.e., a one-off <tt>.sif</tt> file containing a Conda environment that has everything you need to run your application. We strongly discourage installing software interactively with Conda inside a container and will not show how to do this here. | ||
<!--T:146--> | |||
Creating an Apptainer image and using Conda to install software inside it is a 3-step process. The first step is to create a <tt>.yml</tt> file describing the Conda environment we wish to create inside the container. In the example that follows, we create the file <tt>environment.yml</tt> . This file is where we give our environment a name, then give Conda a list of packages that must be installed and the channels where to look for them. For more information [https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually see here]. | Creating an Apptainer image and using Conda to install software inside it is a 3-step process. The first step is to create a <tt>.yml</tt> file describing the Conda environment we wish to create inside the container. In the example that follows, we create the file <tt>environment.yml</tt> . This file is where we give our environment a name, then give Conda a list of packages that must be installed and the channels where to look for them. For more information [https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually see here]. | ||
<!--T:147--> | |||
{{File | {{File | ||
|name=environment.yml | |name=environment.yml | ||
Line 433: | Line 437: | ||
}} | }} | ||
<!--T:148--> | |||
Second, we create an Apptainer [https://apptainer.org/docs/user/main/definition_files.html image definition file]. This file, here called <tt>image.def</tt>, describes what are the steps Apptainer should take to create our image. These steps are: | Second, we create an Apptainer [https://apptainer.org/docs/user/main/definition_files.html image definition file]. This file, here called <tt>image.def</tt>, describes what are the steps Apptainer should take to create our image. These steps are: | ||
#Pull a Docker image from DockerHub that has the micromamba package manager pre-installed. | #Pull a Docker image from DockerHub that has the micromamba package manager pre-installed. | ||
Line 438: | Line 443: | ||
#Call micromamba and have it configure the environment defined in <tt>environment.yml</tt>. | #Call micromamba and have it configure the environment defined in <tt>environment.yml</tt>. | ||
<!--T:149--> | |||
{{File | {{File | ||
|name=image.def | |name=image.def | ||
Line 445: | Line 451: | ||
From: mambaorg/micromamba:latest | From: mambaorg/micromamba:latest | ||
<!--T:150--> | |||
%files | %files | ||
environment.yml /environment.yml | environment.yml /environment.yml | ||
<!--T:151--> | |||
%post | %post | ||
micromamba install -n base --file environment.yml && \ | micromamba install -n base --file environment.yml && \ | ||
Line 453: | Line 461: | ||
}} | }} | ||
<!--T:152--> | |||
The last step is to build the Apptainer image using the definition file above: | The last step is to build the Apptainer image using the definition file above: | ||
module load apptainer | module load apptainer |