Suppose you have a script my_script.py depending on rlberry that you want to execute in a container.
Pull the container with
$ singularity pull --arch amd64 library://tmath/rlberry/rlberry:testThis will download a 3.2GiB sif image with pre-installed rlberry.
Then, get a shell in the container with,
$ singularity shell rlberry_test.sifNow, the container is mounted and you can use python, rlberry, ffmpeg, torch...
Singularity> python my_script.pyAnd its done ! The container also contain jupyter notebooks which can be launched with the command jupyter notebook.
It does not contain any ide.
You can install new python libraries as user but to install new packages you need admin access
$ singularity overlay create --size 1024 rlberry.sif # create a 1GiB overlay that will be used to stock new installed packages
$ sudo singularity shell rlberry.sif
Singularity> apt update
Singularity> apt install htopThen, the new container rlberry.sif (now of size 4.2 GiB) will contain the package (here htop) the next time you use singularity shell rlberry.sif.
An example of application of this is to construct an ad-hoc image that you will then upload on a HPC server to do the computation.
The image in the singularity library was constructed from pytorch docker image using the following def file:
Bootstrap: docker
From: pytorch/pytorch
%post
apt-get -y update
apt-get -y install python python3-pip git vim
pip3 install -U pip
pip3 install notebook
pip3 install git+https://github.com/rlberry-py/rlberry
%environment
export LC_ALL=C
%runscript
jupyter notebook
%labels
Author berries_eater
and the build command
sudo singularity build rlberry.sif rlberry.def