Skip to content

Commit 0dee75c

Browse files
committed
fix(dockerfile): bootstrap pip via get-pip.py for non-3.12 GPU builds
Ubuntu 22.04's system python3.10 has ensurepip disabled by Debian policy, which broke the side-by-side torch install for 3.10 GPU images (CI: docker-test-gpu (3.10), docker-test-lb (3.10)). python3.11 is a separate interpreter without the disable, so only 3.10 was affected. Use urllib+get-pip.py instead of ensurepip — works for any interpreter regardless of distro patching, and urllib is stdlib so no curl dep. Also corrects the outdated deadsnakes comment on both Dockerfiles: the runpod/pytorch base image layers alt-Python 3.11/3.12 on top of the system 3.10, not via deadsnakes.
1 parent 161eb22 commit 0dee75c

2 files changed

Lines changed: 24 additions & 10 deletions

File tree

Dockerfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Base image provides Python 3.9-3.13 via deadsnakes; only 3.12 has torch
2-
# pre-installed. For 3.10 and 3.11 we reinstall torch from the CUDA 12.8
3-
# wheel index (~7 GB overhead) and repoint /usr/local/bin/python so the
4-
# worker CMD picks up the correct interpreter.
1+
# Base image (runpod/pytorch:ubuntu2204) ships Ubuntu 22.04 system python3.10
2+
# plus alt-Python interpreters for 3.11/3.12 with torch pre-installed on 3.12.
3+
# For non-3.12 targets we reinstall torch from the CUDA 12.8 wheel index
4+
# (~7 GB overhead) and repoint /usr/local/bin/python so the worker CMD picks
5+
# up the correct interpreter.
56
FROM runpod/pytorch:1.0.3-cu1281-torch291-ubuntu2204
67

78
# Target Python version for the worker runtime.
@@ -17,9 +18,15 @@ ENV FLASH_PYTHON_VERSION=${PYTHON_VERSION}
1718
# /usr/local/bin/python and python3 so downstream `python` invocations use it.
1819
# For 3.12 we keep the base image's python/torch untouched to avoid the
1920
# ~7 GB reinstall cost.
21+
#
22+
# pip bootstrap: Ubuntu 22.04's system python3.10 has ensurepip disabled by
23+
# Debian policy, so we install pip via get-pip.py (works for any interpreter
24+
# regardless of distro patching). urllib is stdlib, avoiding a curl dependency.
2025
RUN python${PYTHON_VERSION} --version \
2126
&& if [ "${PYTHON_VERSION}" != "3.12" ]; then \
22-
python${PYTHON_VERSION} -m ensurepip --upgrade \
27+
python${PYTHON_VERSION} -c "import urllib.request; urllib.request.urlretrieve('https://bootstrap.pypa.io/get-pip.py', '/tmp/get-pip.py')" \
28+
&& python${PYTHON_VERSION} /tmp/get-pip.py --no-cache-dir \
29+
&& rm -f /tmp/get-pip.py \
2330
&& python${PYTHON_VERSION} -m pip install --no-cache-dir \
2431
--index-url ${TORCH_INDEX_URL} \
2532
"torch==${TORCH_VERSION}" \

Dockerfile-lb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Base image provides Python 3.9-3.13 via deadsnakes; only 3.12 has torch
2-
# pre-installed. For 3.10 and 3.11 we reinstall torch from the CUDA 12.8
3-
# wheel index (~7 GB overhead) and repoint /usr/local/bin/python so the
4-
# worker CMD picks up the correct interpreter.
1+
# Base image (runpod/pytorch:ubuntu2204) ships Ubuntu 22.04 system python3.10
2+
# plus alt-Python interpreters for 3.11/3.12 with torch pre-installed on 3.12.
3+
# For non-3.12 targets we reinstall torch from the CUDA 12.8 wheel index
4+
# (~7 GB overhead) and repoint /usr/local/bin/python so the worker CMD picks
5+
# up the correct interpreter.
56
FROM runpod/pytorch:1.0.3-cu1281-torch291-ubuntu2204
67

78
# Target Python version for the worker runtime.
@@ -17,9 +18,15 @@ ENV FLASH_PYTHON_VERSION=${PYTHON_VERSION}
1718
# /usr/local/bin/python and python3 so downstream `python` invocations use it.
1819
# For 3.12 we keep the base image's python/torch untouched to avoid the
1920
# ~7 GB reinstall cost.
21+
#
22+
# pip bootstrap: Ubuntu 22.04's system python3.10 has ensurepip disabled by
23+
# Debian policy, so we install pip via get-pip.py (works for any interpreter
24+
# regardless of distro patching). urllib is stdlib, avoiding a curl dependency.
2025
RUN python${PYTHON_VERSION} --version \
2126
&& if [ "${PYTHON_VERSION}" != "3.12" ]; then \
22-
python${PYTHON_VERSION} -m ensurepip --upgrade \
27+
python${PYTHON_VERSION} -c "import urllib.request; urllib.request.urlretrieve('https://bootstrap.pypa.io/get-pip.py', '/tmp/get-pip.py')" \
28+
&& python${PYTHON_VERSION} /tmp/get-pip.py --no-cache-dir \
29+
&& rm -f /tmp/get-pip.py \
2330
&& python${PYTHON_VERSION} -m pip install --no-cache-dir \
2431
--index-url ${TORCH_INDEX_URL} \
2532
"torch==${TORCH_VERSION}" \

0 commit comments

Comments
 (0)