Skip to content

Commit ccf1bbb

Browse files
PicoNVIDIAnv-edwli
authored andcommitted
fix: install python3.12 from python-build-standalone instead of deadsnakes PPA
The previous block used `add-apt-repository -y ppa:deadsnakes/ppa`, which relies on launchpadlib reaching api.launchpad.net. That endpoint is blocked or unreachable on at least some Brev networks (verified failing on Crusoe), causing the call to silently time out. With no `set -e` in preBuild, the build then continued without python3.12, deleted the working pip3.10 (`rm -rf /usr/bin/pip*`), and left subsequent steps ("pip install -r requirements.txt") with no pip on PATH. Switching to python-build-standalone (tarball served from github.com, which is reliably reachable) makes python3.12 installation deterministic and offline-from-launchpad-safe. Also removes `python3.12-venv` from apt.txt since the tarball ships venv built in. deepagents (and several other deps in requirements.txt) require Python >= 3.11, so falling back to the base image's python3.10 is not viable.
1 parent b98e883 commit ccf1bbb

2 files changed

Lines changed: 24 additions & 10 deletions

File tree

apt.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ jq
88
vim
99
nodejs
1010
npm
11-
python3.12-venv

preBuild.bash

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,30 @@ export NGC_API_KEY=\$NVIDIA_API_KEY
1818
export NGC_CLI_API_KEY=\$NVIDIA_API_KEY
1919
EOM
2020

21-
# upgrade to python 3.12
22-
sudo add-apt-repository -y ppa:deadsnakes/ppa
23-
sudo apt-get update -y
24-
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y python3.12 python3.12-dev python3.12-venv
25-
sudo rm -rf /usr/bin/pip*
26-
sudo python3.12 -m ensurepip --upgrade
27-
sudo ln -s $(which python3.12) /usr/local/bin/python
28-
sudo ln -s $(which pip3.12) /usr/local/bin/pip
29-
sudo pip install --upgrade setuptools pip
21+
# Install Python 3.12 from python-build-standalone (pre-built CPython tarball).
22+
# NOTE: This block previously used deadsnakes PPA via add-apt-repository, but
23+
# launchpadlib times out reaching api.launchpad.net from some Brev networks
24+
# (e.g. Crusoe). python-build-standalone is a single tarball served from
25+
# github.com, which is reliably reachable. deepagents (and other deps in
26+
# requirements.txt) require Python >= 3.11, so 3.10 fallback is not viable.
27+
ARCH=$(uname -m)
28+
PBS_DATE="20260414"
29+
PY_VERSION="3.12.13"
30+
if [ "$ARCH" = "x86_64" ]; then
31+
PBS_TRIPLE="x86_64-unknown-linux-gnu"
32+
elif [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then
33+
PBS_TRIPLE="aarch64-unknown-linux-gnu"
34+
else
35+
echo "Unsupported architecture: $ARCH"; exit 1
36+
fi
37+
PBS_URL="https://github.com/astral-sh/python-build-standalone/releases/download/${PBS_DATE}/cpython-${PY_VERSION}%2B${PBS_DATE}-${PBS_TRIPLE}-install_only.tar.gz"
38+
echo "Downloading Python ${PY_VERSION} from python-build-standalone..."
39+
curl -fsSL "$PBS_URL" | sudo tar -xz -C /opt/
40+
sudo ln -sf /opt/python/bin/python3.12 /usr/local/bin/python3.12
41+
sudo ln -sf /opt/python/bin/pip3.12 /usr/local/bin/pip3.12
42+
sudo ln -sf /opt/python/bin/python3.12 /usr/local/bin/python
43+
sudo ln -sf /opt/python/bin/pip3.12 /usr/local/bin/pip
44+
sudo /opt/python/bin/pip3.12 install --upgrade setuptools pip
3045

3146
# configure custom docker apt repo
3247
sudo mkdir -p /etc/apt/keyrings

0 commit comments

Comments
 (0)