singularity/Singularity\343\202\263\343\203\263\343\203\206\343\203\212\345\206\205\343\201\247venv\343\202\222\344\275\277\343\201\243\343\201\237Python\343\202\263\343\203\263\343\203\206\343\203\212\343\201\256\344\275\234\346\210\220.md
... ...
@@ -1,61 +0,0 @@
1
-### sifファイル
2
-
3
-```
4
-BootStrap: docker
5
-From: nvcr.io/nvidia/cuda:12.6.3-base-ubuntu24.04
6
-
7
-%setup
8
- setup_dir="${SINGULARITY_ROOTFS}/usr/local/python_env"
9
- mkdir -p "${setup_dir}"
10
- cp "./requirements.txt" "${setup_dir}/requirements.txt"
11
-
12
-%post
13
- export DEBIAN_FRONTEND=noninteractive
14
- export TZ=Asia/Tokyo
15
-
16
- apt update && \
17
- apt install -y \
18
- tzdata \
19
- locales \
20
- curl \
21
- git \
22
- tk-dev \
23
- htop \
24
- language-pack-ja \
25
- libhdf5-serial-dev \
26
- python3 \
27
- python3-pip \
28
- python3-venv
29
-
30
-
31
- # Setup locale
32
- localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
33
-
34
- export python_env_dir="/usr/local/python_env"
35
- export venv_dir="${python_env_dir}/.venv"
36
- cd "${python_env_dir}"
37
- python3 -m venv "${venv_dir}"
38
- . "${venv_dir}/bin/activate"
39
- pip install -r "${python_env_dir}/requirements.txt"
40
-
41
- # Clean up
42
- apt clean
43
- rm -rf /var/lib/apt/lists/*
44
-
45
-%runscript
46
- #!/bin/bash
47
- set -euo pipefail
48
- source /usr/local/python_env/.venv/bin/activate
49
-
50
- exec "$@"
51
-
52
-%environment
53
- export LANG=en_US.utf8
54
- export DEBIAN_FRONTEND=noninteractive
55
- export TZ=Asia/Tokyo
56
-```
57
-
58
-### 実行
59
-```
60
-$ singularity run python_env.sif python3
61
-```
... ...
\ No newline at end of file