Skip to content

Commit 52a6a53

Browse files
committed
Refine the environment
1 parent 4a3dbdc commit 52a6a53

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

uv/Dockerfile

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ RUN apt-get install -y ffmpeg libsm6 libxext6 libgl1
4343

4444
# Utils
4545
RUN apt-get install -y vim git bzip2 tmux wget tar htop curl
46-
RUN add-apt-repository ppa:deadsnakes/ppa && apt-get install -y python3.12 python3.12-dev python3.12-venv
4746

48-
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
49-
RUN update-alternatives --set python3 /usr/bin/python3.12
50-
RUN ln -sf /usr/bin/python3.12-config /usr/bin/python3-config
51-
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12
47+
RUN add-apt-repository ppa:deadsnakes/ppa && apt-get install -y python${PY_VERSION} python${PY_VERSION}-dev python${PY_VERSION}-venv
48+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python${PY_VERSION} 1
49+
RUN update-alternatives --set python3 /usr/bin/python${PY_VERSION}
50+
RUN ln -sf /usr/bin/python${PY_VERSION}-config /usr/bin/python3-config
51+
RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python${PY_VERSION}
52+
53+
RUN apt-get install -y python3-setuptools python3-dev libpython${PY_VERSION}-dev
5254

5355
RUN curl -LsSf https://astral.sh/uv/0.8.14/install.sh | sh
5456

@@ -67,9 +69,9 @@ VISION_VER=\$2
6769
CUDA_VER=\$3
6870
BASE_DIR=/ddiff-base/py\${PY_VERSION}-torch\${TORCH_VER}
6971
mkdir -p "\$BASE_DIR" && cd "\$BASE_DIR"
70-
uv venv --python "\${PY_VERSION}" --system-site-packages
72+
uv venv --python "\${PY_VERSION}" --system-site-packages --seed
7173
uv pip install --no-cache torch=="\${TORCH_VER}" torchvision=="\${VISION_VER}" torchaudio=="\${TORCH_VER}" --index-url "https://download.pytorch.org/whl/\${CUDA_VER}"
72-
echo "ln -sfn \${BASE_DIR}/.venv ./.venv && echo Created uv virtual environment with torch==\${TORCH_VER}" > /usr/local/bin/uv_init_torch\${TORCH_VER}
74+
echo "ln -sfn \${BASE_DIR}/.venv ./.venv && uv add torch==\${TORCH_VER} torchvision==\${VISION_VER} torchaudio==\${TORCH_VER} && echo Created uv virtual environment with torch==\${TORCH_VER}" > /usr/local/bin/uv_init_torch\${TORCH_VER}
7375
chmod +x /usr/local/bin/uv_init_torch\${TORCH_VER}
7476
EOF
7577
RUN chmod +x /usr/local/bin/install_torch_env

uv/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ RUN bash -c uv_init_torch2.5.1
2626

2727
# 2. Install additional packages (without torch)
2828
COPY pyproject.yaml /<your workspace>
29-
RUN uv pip install --no-install torch --no-install torchvision --no-install torchaudio .
29+
RUN uv pip install .
3030

3131
```
3232

0 commit comments

Comments
 (0)