Skip to content

Commit f0acf21

Browse files
committed
Dockerfile.base: PyPI versions of pip[-tools]
1 parent 926f8ea commit f0acf21

File tree

3 files changed

+12
-113
lines changed

3 files changed

+12
-113
lines changed

.github/container/Dockerfile.base

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ ARG CLANG_VERSION
1717
ARG JAX_TOOLBOX_REF
1818
ENV CUDA_BASE_IMAGE=${BASE_IMAGE}
1919

20+
# Install all python packages system-wide.
21+
ENV PIP_BREAK_SYSTEM_PACKAGES=1
22+
2023
###############################################################################
2124
## Install Python and essential tools
2225
###############################################################################
@@ -38,6 +41,7 @@ apt_packages=(
3841
liblzma-dev
3942
python-is-python3
4043
python3-pip
44+
python3.12-dev
4145
rsync
4246
vim
4347
wget
@@ -46,8 +50,6 @@ apt_packages=(
4650
# llvm.sh
4751
lsb-release
4852
software-properties-common
49-
# GCP autoconfig
50-
pciutils hwloc bind9-host
5153
)
5254
if [[ $(dpkg --print-architecture) == arm64 ]]; then
5355
# h5py: The newest release of of h5py (3.11.0) does not include ARM wheels and causes pip to build h5py.
@@ -90,12 +92,16 @@ EOL
9092
apt-get clean
9193
rm -rf /var/lib/apt/lists/*
9294

95+
# Upgrade pip from PyPI before we remove the Ubuntu version
96+
pip install --ignore-installed --no-cache-dir --upgrade pip
97+
9398
# There are several python packages (in the list below) that are installed with OS
9499
# package manager (the run of `apt-get install` above) and can not be uninstall
95100
# using pip (in pip-finalize.sh script) during JAX installation. Remove then in
96101
# advance to avoid JAX installation issue.
97102
remove_packages=(
98103
python3-gi
104+
python3-pip
99105
software-properties-common
100106
lsb-release
101107
python3-yaml
@@ -117,24 +123,9 @@ ADD --chmod=777 \
117123
/usr/local/bin/
118124
RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$(dpkg --print-architecture) -O /usr/local/bin/yq && \
119125
chmod 777 /usr/local/bin/yq
120-
RUN git clone -b 23.3.1 https://github.com/pypa/pip.git /opt/pip
121-
# Patch is specific to 23.3.1
122-
# Generated via: "git diff > pip-vcs-equivalency.patch"
123-
ADD pip-vcs-equivalency.patch /opt/pip/
124-
RUN <<EOF bash -e -x
125-
cd /opt/pip
126-
git apply </opt/pip/pip-vcs-equivalency.patch
127-
git add -u
128-
git commit -m 'Adds JAX_TOOLBOX_VCS_EQUIVALENCY as a trigger to treat all github VCS installs for a package as equivalent. The spec of the last encountered version will be used'
129-
EOF
130126

131-
# install all python packages system-wide.
132-
ENV PIP_BREAK_SYSTEM_PACKAGES=1
133-
# An extra flag `--ignore-installed` is added below, because of the following reason:
134-
# after upgrading to ver 23.3.1 (from /opt/pip) `pip` tries to uninstall itself (default pip-24.0)
135-
# and fails due to pip-24.0 has been installed with system tool `apt` but not `python`. So we keep
136-
# both pip-24.0 and pip-23.3.1 in the system, but use 23.3.1 with equivalency patch (see above).
137-
RUN pip install --upgrade --ignore-installed --no-cache-dir -e /opt/pip pip-tools && rm -rf ~/.cache/*
127+
# pip-tools are used by pip-finalize.sh
128+
RUN pip install --no-cache-dir pip-tools
138129

139130
###############################################################################
140131
## Symlink for cuDNN

.github/container/pip-finalize.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,8 @@ done | tee requirements.vcs
2828
unset IFS
2929

3030
# Second pip-compile includes one more requirements file that pins all vcs installs
31-
# Uses a special env var to let our custom pip impl know to treat the following as
32-
# equivalent:
33-
#
34-
# fiddle @ git+https://github.com/google/fiddle
35-
# fiddle @ git+https://github.com/google/fiddle@cd4497e4c09bdf95dcccaa1e138c2c125d32d39f
36-
#
37-
# JAX_TOOLBOX_VCS_EQUIVALENCY is an environment variable enabling custom logic in pip
38-
# that treats the above as equivalent and prefers the URI wit the SHA
39-
JAX_TOOLBOX_VCS_EQUIVALENCY=true pip-compile -o requirements.txt requirements.vcs $(ls requirements-*.in)
31+
# NB there was an old patch to do with equivalency; kw JAX_TOOLBOX_VCS_EQUIVALENCY
32+
pip-compile -o requirements.txt requirements.vcs $(ls requirements-*.in)
4033

4134
# If there are unpinned VCS dependencies, error since these should be included in the manifest
4235
unpinned_vcs_dependencies=$(cat requirements.txt | egrep '^[^#].+ @ git\+' | egrep -v '^[^#].+ @ git\+.+@' || true)

.github/container/pip-vcs-equivalency.patch

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)