Python environment in a container

Objectives

  • Learn how to create a Python environment in an apptainer image

Background

Python environments are nowadays very popular due to the popularity of Python as a scientific programming language. These environments can sometimes be problematic for the filesystem as they require thousands of files.

Exercise 1: Creating Python image with image’s pip

Install Python environment to base python image

Use the base python image and install following packages to the image:
  • python

  • numpy

  • pandas

Exercise 2: Creating conda/mamba environment in an image

Install an environment to an apptainer image using an optimized definition file

Create an environment with this definition file customized for environment creation:

https://github.com/simo-tuomisto/micromamba-apptainer

Install the following packages to the environment:
  • python

  • numpy

  • pandas