Install free threaded python3.13t to the ml_build arm64 docker image

python3.13-nogil is a free-threaded build of python3.13.

PiperOrigin-RevId: 728246352
This commit is contained in:
Kanglan Tang
2025-02-18 09:40:39 -08:00
committed by TensorFlower Gardener
parent 5efb5dfaa6
commit ea72e93812
2 changed files with 15 additions and 1 deletions

View File

@@ -64,6 +64,8 @@ RUN /setup.python.sh python3.10 requirements.txt
RUN /setup.python.sh python3.11 requirements.txt
RUN /setup.python.sh python3.12 requirements.txt
RUN /setup.python.sh python3.13 requirements.txt
# python3.13-nogil is a free-threaded build of python3.13.
RUN /setup.python.sh python3.13-nogil requirements.txt
# Python commands by default run under 3.11
RUN ln -sf /usr/bin/python3.11 /usr/bin/python3

View File

@@ -25,7 +25,11 @@ REQUIREMENTS=$2
add-apt-repository ppa:deadsnakes/ppa
# Install Python packages for this container's version
if [[ ${VERSION} == "python3.13" ]]; then
if [[ ${VERSION} == "python3.13-nogil" ]]; then
cat >pythons.txt <<EOF
$VERSION
EOF
elif [[ ${VERSION} == "python3.13" ]]; then
cat >pythons.txt <<EOF
$VERSION
$VERSION-dev
@@ -63,5 +67,13 @@ wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 --tries=5
/usr/bin/$VERSION get-pip.py
/usr/bin/$VERSION -m pip install --no-cache-dir --upgrade pip
# For Python 3.13t, do not install twine as it does not have pre-built wheels
# for this Python version and building it from source fails. We only need twine
# to be present on the system Python which in this case is 3.12.
if [[ ${VERSION} == "python3.13-nogil" ]]; then
grep -v "twine" $REQUIREMENTS > requirements_without_twine.txt
REQUIREMENTS=requirements_without_twine.txt
fi
# Disable the cache dir to save image space, and install packages
/usr/bin/$VERSION -m pip install --no-cache-dir -r $REQUIREMENTS -U