Skip to content

fix(ci): Build python wheels using interpreters in manylinux2014#2486

Merged
chaokunyang merged 25 commits into
apache:mainfrom
esafak:ci_manylinux
Aug 19, 2025
Merged

fix(ci): Build python wheels using interpreters in manylinux2014#2486
chaokunyang merged 25 commits into
apache:mainfrom
esafak:ci_manylinux

Conversation

@esafak
Copy link
Copy Markdown
Contributor

@esafak esafak commented Aug 17, 2025

What does this PR do?

The existing workflow did not build wheels correctly because the python interpreter installed in the workflow was not used in the container where the actual building was taking place. The manylinux images already have every python version pre-installed. We now use them instead.

Key changes include:

  • New Workflows:

    • build-containerized-pr.yml: Handles building wheels for pull requests using containerized environments for Linux.
    • build-containerized-release.yml: Handles building wheels for releases using containerized environments for Linux.
    • build-native-pr.yml: Handles building wheels for pull requests on macOS and Windows.
    • build-native-release.yml: Handles building wheels for releases on macOS and Windows.
  • Removed Workflows:

    • .github/workflows/build-wheels.yaml: This generic workflow has been superseded by the new, more specific workflows.
    • .github/workflows/build-wheels-for-pr.yaml: Merged into build-containerized-pr.yml and build-native-pr.yml.
    • .github/workflows/build-wheels-for-release.yaml: Merged into build-containerized-release.yml and build-native-release.yml.
    • .github/workflows/build-native-pr.yml: This was a duplicate and is now handled by the new build-native-pr.yml.
  • Script Improvements:

    • ci/build_linux_wheels.py: Introduced a new script to manage Linux wheel building within Docker containers, replacing build_manylinux_wheel.sh. This script now uses explicit Docker image definitions and a simplified execution model.
    • ci/deploy.sh: Updated to use PYTHON_PATH and PIP_CMD for better Python environment management, and adjusted pyarrow installation versions for different Python versions.
    • ci/run_ci.sh: Updated to correctly handle Bazel installation paths (avoiding sudo) and use curl for downloading Bazel, since wget is not in the container.
  • Workflow Triggers:

    • Workflows are now triggered based on their intended purpose (e.g., push to main or tags for releases, pull_request events for PR builds).
    • Path filters have been adjusted to ensure workflows trigger only when relevant files are changed.

Related issues

Closes #2480

Notes

I also attempted to create musl builds but they failed because the bazel binaries are incompatible with it. We would need to rebuild bazel for musllinux.

*   Introduce `ci/build_linux_wheels.py` to manage Linux wheel builds.
*   Remove the shell script `ci/build_manylinux_wheel.sh`.
*   Update `.github/workflows/build-wheels.yaml` to use the new Python script.
*   Define manylinux and musllinux images directly in the Python script.
*   Simplify the build process by removing explicit image environment variables.
*   Enhance flexibility by allowing multiple images per architecture.
@esafak esafak changed the title CI: Replace build_manylinux_wheel.sh with Python script ci: Replace build_manylinux_wheel.sh with Python script Aug 17, 2025
esafak added 9 commits August 17, 2025 18:16
*   Remove the generic `build-wheels.yaml` workflow.
*   Introduce `build-native-release.yml` for building native wheels on macOS and Windows for releases.
*   Rename `build-wheels-for-pr.yaml` to `build-native-pr.yml` and update its triggers and matrix.
*   Rename `build-wheels-for-release.yaml` to `build-containerized-pr.yml` and update its triggers and matrix.
*   Create `build-containerized-release.yml` for building containerized wheels on Linux for releases.
*   Update `release-python.yaml` to depend on the new native and containerized release workflows.
*   Modify `ci/run_ci.sh` to use `curl` for downloading Bazel and to adjust the Bazel installation directory.
*   Update `ci/build_linux_wheels.py` to allow specifying Python versions and to add a `--release` flag for full test suites.
*   Adjust Bazel job count calculation in `ci/run_ci.sh` to be based on the OS variable.
@esafak esafak changed the title ci: Replace build_manylinux_wheel.sh with Python script fix(ci): Build containerized python wheels using the pre-installed interpreters Aug 18, 2025
esafak added 6 commits August 18, 2025 12:58
*   Remove explicit Bazel installation step from `.github/workflows/build-containerized-pr.yml`.
*   The `ci/run_ci.sh` script now includes a `ls "$BAZEL_DIR"` command for better visibility.
*   Added `git config --global --add safe.directory /work` to `ci/build_linux_wheels.py` to prevent Git errors in containerized environments.
…ci_manylinux)

* Improve Bazel verification in `run_ci.sh` by adding detailed checks:
    * `ls -l` for the Bazel executable.
    * `file` command to determine file type.
    * `head -n 1` for initial content inspection.
    * `readelf -l` to inspect ELF interpreter information.
    * `strings` to find the loader path if `readelf` is unavailable.
    * `ldd` to identify potential library load errors.
* Modify `deploy.sh` to prioritize Python from `$PYTHON_PATH` for `pyarrow` and `numpy` installations, falling back to default `python` if not set.
* Update `build_linux_wheels.py` to explicitly `export PYTHON_PATH` for each Python version tested, ensuring consistent usage within the script.
* Use PYTHON_PATH for python and pip commands if available.
* Remove musllinux images from build_linux_wheels.py as bazel binaries are not compatible.
* Removed extensive and verbose checks for Bazel installation in `ci/run_ci.sh`.
* Simplified the output message in `ci/build_linux_wheels.py` from "Testing with" to "Using" for preinstalled Python interpreters.
* Added printing of the PATH environment variable in `python/setup.py` for better debugging.
* Removed an unnecessary blank line in `python/setup.py`.
@esafak esafak requested a review from chaokunyang as a code owner August 18, 2025 19:24
@esafak esafak changed the title fix(ci): Build containerized python wheels using the pre-installed interpreters fix(ci): Build containerized python wheels interpreters in manylinux2014 Aug 18, 2025
@esafak esafak changed the title fix(ci): Build containerized python wheels interpreters in manylinux2014 fix(ci): Build python wheels using interpreters in manylinux2014 Aug 18, 2025
Comment thread ci/build_linux_wheels.py
Copy link
Copy Markdown
Collaborator

@chaokunyang chaokunyang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just left a minor comment

@chaokunyang chaokunyang merged commit c7cd352 into apache:main Aug 19, 2025
64 checks passed
@esafak esafak deleted the ci_manylinux branch August 19, 2025 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl not installable on linux

2 participants