diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index fd23e0cf217e6..c3ca66719a5cf 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -472,7 +472,7 @@ jobs: shell: msys2 {0} env: PIPX_BIN_DIR: /usr/local/bin - PIPX_PYTHON: ${{ steps.python-install.outputs.python-path }} + PIPX_BASE_PYTHON: ${{ steps.python-install.outputs.python-path }} run: | ci/scripts/install_gcs_testbench.sh default - name: Test diff --git a/ci/docker/conda-cpp.dockerfile b/ci/docker/conda-cpp.dockerfile index eb035d887a158..f0084894e19dc 100644 --- a/ci/docker/conda-cpp.dockerfile +++ b/ci/docker/conda-cpp.dockerfile @@ -44,7 +44,7 @@ RUN mamba install -q -y \ # We want to install the GCS testbench using the Conda base environment's Python, # because the test environment's Python may later change. -ENV PIPX_PYTHON=/opt/conda/bin/python3 +ENV PIPX_BASE_PYTHON=/opt/conda/bin/python3 COPY ci/scripts/install_gcs_testbench.sh /arrow/ci/scripts RUN /arrow/ci/scripts/install_gcs_testbench.sh default diff --git a/ci/docker/python-wheel-manylinux-test.dockerfile b/ci/docker/python-wheel-manylinux-test.dockerfile index 443ff9c53cbcb..09883f9780a36 100644 --- a/ci/docker/python-wheel-manylinux-test.dockerfile +++ b/ci/docker/python-wheel-manylinux-test.dockerfile @@ -19,13 +19,19 @@ ARG arch ARG python_image_tag FROM ${arch}/python:${python_image_tag} -# RUN pip install --upgrade pip - # pandas doesn't provide wheel for aarch64 yet, so cache the compiled # test dependencies in a docker image COPY python/requirements-wheel-test.txt /arrow/python/ RUN pip install -r /arrow/python/requirements-wheel-test.txt +# Install the GCS testbench with the system Python +RUN apt-get update -y -q && \ + apt-get install -y -q \ + build-essential \ + python3-dev && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists* + COPY ci/scripts/install_gcs_testbench.sh /arrow/ci/scripts/ -ARG python -RUN PYTHON_VERSION=${python} /arrow/ci/scripts/install_gcs_testbench.sh default +ENV PIPX_PYTHON=/usr/bin/python3 PIPX_PIP_ARGS=--prefer-binary +RUN /arrow/ci/scripts/install_gcs_testbench.sh default diff --git a/ci/scripts/install_gcs_testbench.sh b/ci/scripts/install_gcs_testbench.sh index 78826e94d3294..48a5858a358c9 100755 --- a/ci/scripts/install_gcs_testbench.sh +++ b/ci/scripts/install_gcs_testbench.sh @@ -39,18 +39,21 @@ if [[ "${version}" -eq "default" ]]; then version="v0.39.0" fi -: ${PIPX_PYTHON:=$(which python3)} +# The Python to install pipx with +: ${PIPX_BASE_PYTHON:=$(which python3)} +# The Python to install the GCS testbench with +: ${PIPX_PYTHON:=${PIPX_BASE_PYTHON:-$(which python3)}} export PIP_BREAK_SYSTEM_PACKAGES=1 -${PIPX_PYTHON} -m pip install -U pipx +${PIPX_BASE_PYTHON} -m pip install -U pipx -# This script is run with PYTHON undefined in some places, -# but those only use older pythons. -if [[ -z "${PYTHON_VERSION}" ]] || [[ "${PYTHON_VERSION}" != "3.13" ]]; then - pipx_flags=--verbose - if [[ $(id -un) == "root" ]]; then - # Install globally as /root/.local/bin is typically not in $PATH - pipx_flags="${pipx_flags} --global" - fi - ${PIPX_PYTHON} -m pipx install ${pipx_flags} "https://github.com/googleapis/storage-testbench/archive/${version}.tar.gz" +pipx_flags=(--verbose --python ${PIPX_PYTHON}) +if [[ $(id -un) == "root" ]]; then + # Install globally as /root/.local/bin is typically not in $PATH + pipx_flags+=(--global) fi +if [[ -n "${PIPX_PIP_ARGS}" ]]; then + pipx_flags+=(--pip-args "'${PIPX_PIP_ARGS}'") +fi +${PIPX_BASE_PYTHON} -m pipx install ${pipx_flags[@]} \ + "https://github.com/googleapis/storage-testbench/archive/${version}.tar.gz" diff --git a/dev/tasks/python-wheels/github.osx.yml b/dev/tasks/python-wheels/github.osx.yml index b26aeba32b79b..a65bf9b56addf 100644 --- a/dev/tasks/python-wheels/github.osx.yml +++ b/dev/tasks/python-wheels/github.osx.yml @@ -113,6 +113,21 @@ jobs: name: wheel path: arrow/python/repaired_wheels/*.whl + # Use a well-known Python version for the GCS testbench, and avoid + # putting it in PATH. + - name: Set up Python for GCS testbench + uses: actions/setup-python@v5.1.1 + id: gcs-python-install + with: + python-version: 3.12 + update-environment: false + + - name: Install GCS testbench + env: + PIPX_BIN_DIR: /usr/local/bin + PIPX_BASE_PYTHON: {{ '${{ steps.gcs-python-install.outputs.python-path }}' }} + run: arrow/ci/scripts/install_gcs_testbench.sh default + - name: Test Wheel env: PYTEST_ADDOPTS: "-k 'not test_cancellation'" @@ -121,7 +136,6 @@ jobs: source test-env/bin/activate pip install --upgrade pip wheel arch -{{ arch }} pip install -r arrow/python/requirements-wheel-test.txt - PYTHON_VERSION={{ python_version }} arch -{{ arch }} arrow/ci/scripts/install_gcs_testbench.sh default arch -{{ arch }} arrow/ci/scripts/python_wheel_unix_test.sh $(pwd)/arrow {{ macros.github_upload_releases("arrow/python/repaired_wheels/*.whl")|indent }}