python_3.9.def 3.22 KB
Newer Older
1 2 3 4
Bootstrap: docker
From: centos:8

%help 
5
This is a singularity container packing a python 3.9.6 (only version) environment with all the packages necessary to execute all the python scripts present in the version 2.10.0 of the gad pipeline.
6
Python v3.9.6 is the latest available version in CentOS v8.5.211 used for this build.
7
Authors : valentin.vautrot@u-bourgogne.fr
8

9
python3.9.6 is installed in /usr/bin/python3.9/
10

11
non-default python3.9.6 libs are installed in /usr/lib/python3.9/site-packages/
12
pip-installed packages can be listed with :
13 14 15 16 17 18
singularity exec -e /path/to/this/sif/image python3 -m pip list installed
or
singularity test /path/to/this/sif/image

Other custom GAD packages include GeneralTools, LabkeyTools, InterTools, VcfTools, CnvTools from v2.10.0 of the gadpipeline, modified to work with python3.9
(= from the 2.11.0_python3 branch)
19 20 21 22 23 24 25 26 27 28

%setup
SINGULARITY_ROOTFS=$APPTAINER_ROOTFS
mkdir ${SINGULARITY_ROOTFS}/data

%files
# import custom python packages from local machine
/home/valentinv/Documents/GitLab/gadpipeline/common/GeneralTools.py /data/
/home/valentinv/Documents/GitLab/gadpipeline/common/LabkeyTools.py /data/
/home/valentinv/Documents/GitLab/gadpipeline/common/InterTools.py /data/
29 30
/home/valentinv/Documents/GitLab/gadpipeline/common/VcfTools.py /data/
/home/valentinv/Documents/GitLab/gadpipeline/common/CnvTools.py /data/
31 32 33 34 35

%post
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

36
dnf install -y epel-release
37
dnf update -y libmodulemd
38 39
dnf update -y --exclude=filesystem
# filesystem packages updates poses problems by tempering with /proc, which is supposed to be owned by root, but is not in the .sif image
40

41
dnf remove -y python3 && dnf autoremove
42
dnf install -y python39
43

44 45 46
# install non-pip python packages
mv /data/GeneralTools.py /usr/lib/python3.9/site-packages/
mv /data/LabkeyTools.py /usr/lib/python3.9/site-packages/
47
# import of LabkeyTools.py in python3 causes error (TabError - indentation). Probably compatibility problem from python2
48 49 50
mv /data/InterTools.py /usr/lib/python3.9/site-packages/
mv /data/VcfTools.py /usr/lib/python3.9/site-packages/
mv /data/CnvTools.py /usr/lib/python3.9/site-packages/
51

52
# install python pip packages
53 54 55 56
pip3.9 install --upgrade -t /usr/lib/python3.9/site-packages/ labkey
pip3.9 install --upgrade -t /usr/lib/python3.9/site-packages/ numpy
pip3.9 install --upgrade -t /usr/lib/python3.9/site-packages/ matplotlib
pip3.9 install --upgrade -t /usr/lib/python3.9/site-packages/ pandas
57
# pip3.9 install --upgrade -t /usr/lib/python3.9/site-packages/ plotly
58
# is causing an error due to plotly.plotly module being deprecated in python3.9. chart-studio package (with the chart_studio.plotly module) is to be used in replacement.
59
pip3.9 install --upgrade -t /usr/lib/python3.9/site-packages/ chart-studio
60
pip3.9 install --upgrade -t /usr/lib/python3.9/site-packages/ scipy
61 62
pip3.9 install --upgrade -t /usr/lib/python3.9/site-packages/ pyvcf
pip3.9 install --upgrade -t /usr/lib/python3.9/site-packages/ simplejson
63

64
#cleaning
65
rmdir /data/
66 67 68 69 70

%test
echo "python version :"
python3 -V
echo "listing installed pip packages :" 
71 72 73
python3 -m pip list 

%labels 
74
Contained_OS_version CentOS_8.5.211
75
Contained_python_version 3.9.6