This is an automated email from the ASF dual-hosted git repository.

Abacn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new d2d7ef88eac Prefer binary wheels when installing Python container 
dependencies (#39402)
d2d7ef88eac is described below

commit d2d7ef88eac2f37ef5f0403d3a9ab2a4906577e7
Author: Abdelrahman Ibrahim <[email protected]>
AuthorDate: Wed Jul 22 15:18:21 2026 +0300

    Prefer binary wheels when installing Python container dependencies (#39402)
    
    * Speed up Python container builds with prefer-binary and registry cache
    
    * Address review
    
    * Drop docker registry cache
    
    ---------
    
    Co-authored-by: Abdelrahman Ibrahim <aeldsouky.c>
---
 sdks/python/container/Dockerfile                   | 3 ++-
 sdks/python/container/run_generate_requirements.sh | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sdks/python/container/Dockerfile b/sdks/python/container/Dockerfile
index 7f5aa3604fe..a1e17edb82d 100644
--- a/sdks/python/container/Dockerfile
+++ b/sdks/python/container/Dockerfile
@@ -53,7 +53,8 @@ RUN  \
 
     # Install required packages for Beam Python SDK and common dependencies 
used by users.
     # use --no-deps to ensure the list includes all transitive dependencies.
-    pip install --no-deps -r /tmp/base_image_requirements.txt 
--extra-index-url https://download.pytorch.org/whl/cpu && \
+    # use --prefer-binary to avoid compiling wheels from source when prebuilt 
wheels exist.
+    pip install --prefer-binary --no-deps -r /tmp/base_image_requirements.txt 
--extra-index-url https://download.pytorch.org/whl/cpu && \
     rm -rf /tmp/base_image_requirements.txt && \
     python -c "import nltk; nltk.download('stopwords')" && \
     rm /root/nltk_data/corpora/stopwords.zip && \
diff --git a/sdks/python/container/run_generate_requirements.sh 
b/sdks/python/container/run_generate_requirements.sh
index 4c7eea0b739..ed1f57faac4 100755
--- a/sdks/python/container/run_generate_requirements.sh
+++ b/sdks/python/container/run_generate_requirements.sh
@@ -93,8 +93,8 @@ fi
 # Force torch dependencies to be pulled from the PyTorch CPU wheel
 # repository so that they don't include GPU dependencies with
 # non-compliant licenses
-pip install ${PIP_EXTRA_OPTIONS:+"$PIP_EXTRA_OPTIONS"}  --no-cache-dir 
"$SDK_TARBALL""$EXTRAS" $INDEX_URL_OPTION
-pip install ${PIP_EXTRA_OPTIONS:+"$PIP_EXTRA_OPTIONS"}  --no-cache-dir -r 
"$PWD"/sdks/python/container/base_image_requirements_manual.txt
+pip install --prefer-binary ${PIP_EXTRA_OPTIONS:+"$PIP_EXTRA_OPTIONS"}  
--no-cache-dir "$SDK_TARBALL""$EXTRAS" $INDEX_URL_OPTION
+pip install --prefer-binary ${PIP_EXTRA_OPTIONS:+"$PIP_EXTRA_OPTIONS"}  
--no-cache-dir -r 
"$PWD"/sdks/python/container/base_image_requirements_manual.txt
 
 pip uninstall -y apache-beam
 echo "Checking for broken dependencies:"

Reply via email to