-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Docker build error by adding fallback for python3.12-distutils #34144
base: master
Are you sure you want to change the base?
Fix Docker build error by adding fallback for python3.12-distutils #34144
Conversation
…e Ubuntu 20.04 base image with deadsnakes/ppa does not provide python3.12-distutils. This change adds a fallback to python3-distutils and suppresses the error if the specific package is unavailable.
Assigning reviewers. If you would like to opt out of this review, comment R: @Abacn added as fallback since no labels match configuration Available commands:
The PR bot will only process comments in the main thread (not review comments). |
formatting Dockerfile
…shparekh/beam into fix-python-distutils-error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for suggesting the fixes. This Dockerfile has been out-of-date for a while. A preferable fix would be bump to ubuntu-24.04 than patch the Dockerfile
@@ -47,7 +47,10 @@ RUN apt -q update \ | |||
|
|||
RUN mkdir /package | |||
COPY pkglist /package/pkglist | |||
RUN apt-get -q install -y --no-install-recommends $(grep -v '^#' /package/pkglist | cat) | |||
RUN apt-get -q install -y --no-install-recommends \ | |||
$(grep -v '^#' /package/pkglist | grep -v 'python3.12-distutils' | cat) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of patch "grep -v python3.12-distutils" one can remove it in https://github.com/apache/beam/blob/master/dev-support/docker/pkglist directly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the feedback, @Abacn! I agree that bumping the base image to a newer Ubuntu version (e.g., 24.04) is a more sustainable solution.
To ensure compatibility, I’ll test the updated Dockerfile by:
- Building the image locally with
docker build
. - Running the Beam environment setup (
./start-build-env.sh
) to verify the fix. - Executing the Java and Python
wordCount
examples (./gradlew :examples:java:wordCount
and./gradlew :sdks:python:wordCount
) to check downstream impact.
I’ll submit an updated PR with these changes once testing is complete. Please let me know if you have a preferred Ubuntu version or additional tests to include!
Please add a meaningful description for your change here
The Ubuntu 20.04 base image with the deadsnakes/ppa does not provide the
python3.12-distutils package as a separate entity, causing the Docker build
to fail. This commit modifies the Dockerfile to:
using grep.
for the default Python version.
errors and logging a message if unavailable.
This ensures build compatibility across environments where python3.12-distutils
may not be available. Tested successfully with the updated Dockerfile.
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
addresses #123
), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.See the Contributor Guide for more tips on how to make review process smoother.
To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md
GitHub Actions Tests Status (on master branch)
See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.