-
Notifications
You must be signed in to change notification settings - Fork 4.1k
GH-47195: [Python][CI] Add support for building PyArrow library on Windows ARM64 #48539
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
base: main
Are you sure you want to change the base?
Changes from 15 commits
5b538de
85edae5
ed3b9e3
41418e0
4b4855f
bed6a7e
ac2fe4c
b8bd939
4736c8f
9f1c875
46deb51
a3e1b77
cfdad42
02c2d58
94a8475
8c903c8
c594ad7
97df9cd
17dde94
628fd74
167c037
fc9ff54
ccdae3d
0a8ed99
6ffa269
fee93b4
2c840b1
57a345c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,8 +24,31 @@ py -0p | |
|
|
||
| %PYTHON_CMD% -m sysconfig || exit /B 1 | ||
|
|
||
| call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" | ||
| @echo on | ||
| @REM Detect architecture if not set | ||
| if "%arch%"=="" set arch=x64 | ||
|
|
||
| @REM Set Architecture-specific CMAKE Options | ||
| if "%arch%"=="ARM64" ( | ||
| set CMAKE_PLATFORM=ARM64 | ||
| set VCVARS_BAT=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsarm64.bat | ||
| set VCPKG_TARGET_TRIPLET=arm64-windows-static-md | ||
| set ARROW_SRC=%GITHUB_WORKSPACE%\arrow | ||
| set ARROW_DIST=%GITHUB_WORKSPACE%\arrow-dist | ||
| set CMAKE_TOOLCHAIN=-DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake | ||
| set UTF8PROC_SOURCE=-Dutf8proc_SOURCE=BUNDLED | ||
| set ARROW_SIMD_OPTIONS=-DARROW_SIMD_LEVEL=NONE -DARROW_RUNTIME_SIMD_LEVEL=NONE -DARROW_USE_XSIMD=OFF -DARROW_WITH_UTF8PROC=ON | ||
| set XSIMD_SOURCE= | ||
| ) else ( | ||
| set CMAKE_PLATFORM=x64 | ||
| set VCVARS_BAT=C:\Program Files ^(x86^)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat | ||
| set VCPKG_TARGET_TRIPLET=amd64-windows-static-md-%CMAKE_BUILD_TYPE% | ||
| set ARROW_SRC=C:\arrow | ||
| set ARROW_DIST=C:\arrow-dist | ||
| set CMAKE_TOOLCHAIN= | ||
| set UTF8PROC_SOURCE= | ||
| set ARROW_SIMD_OPTIONS= | ||
| set XSIMD_SOURCE=-Dxsimd_SOURCE=BUNDLED | ||
| ) | ||
|
|
||
| echo "=== (%PYTHON%) Clear output directories and leftovers ===" | ||
| del /s /q C:\arrow-build | ||
|
|
@@ -35,7 +58,12 @@ del /s /q C:\arrow\python\build | |
| del /s /q C:\arrow\python\pyarrow\*.so | ||
| del /s /q C:\arrow\python\pyarrow\*.so.* | ||
|
|
||
| call "%VCVARS_BAT%" | ||
| @echo on | ||
|
|
||
| echo "=== (%PYTHON%) Building Arrow C++ libraries ===" | ||
|
|
||
| @REM Common Arrow feature flags | ||
| set ARROW_ACERO=ON | ||
| set ARROW_AZURE=ON | ||
| set ARROW_DATASET=ON | ||
|
|
@@ -47,8 +75,11 @@ set ARROW_ORC=ON | |
| set ARROW_PARQUET=ON | ||
| set PARQUET_REQUIRE_ENCRYPTION=ON | ||
| set ARROW_MIMALLOC=ON | ||
| set ARROW_SUBSTRAIT=ON | ||
| set ARROW_S3=ON | ||
| set CMAKE_GENERATOR=Visual Studio 17 2022 | ||
| set VCPKG_ROOT=C:\vcpkg | ||
| set VCPKG_FEATURE_FLAGS=-manifests | ||
| set ARROW_SUBSTRAIT=ON | ||
| set ARROW_TENSORFLOW=ON | ||
| set ARROW_WITH_BROTLI=ON | ||
| set ARROW_WITH_BZ2=ON | ||
|
|
@@ -59,16 +90,20 @@ set ARROW_WITH_ZLIB=ON | |
| set ARROW_WITH_ZSTD=ON | ||
| set CMAKE_INTERPROCEDURAL_OPTIMIZATION=ON | ||
| set CMAKE_UNITY_BUILD=ON | ||
| set CMAKE_GENERATOR=Visual Studio 17 2022 | ||
| set CMAKE_PLATFORM=x64 | ||
| set VCPKG_ROOT=C:\vcpkg | ||
| set VCPKG_FEATURE_FLAGS=-manifests | ||
| set VCPKG_TARGET_TRIPLET=amd64-windows-static-md-%CMAKE_BUILD_TYPE% | ||
|
|
||
| mkdir C:\arrow-build | ||
| pushd C:\arrow-build | ||
|
|
||
| @REM Configure the CMake build | ||
| cmake ^ | ||
| -DARROW_ACERO=%ARROW_ACERO% ^ | ||
| %CMAKE_TOOLCHAIN% ^ | ||
| -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^ | ||
| -DCMAKE_INSTALL_PREFIX=%ARROW_DIST% ^ | ||
| -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=%CMAKE_INTERPROCEDULAR_OPTIMIZATION% ^ | ||
| -DCMAKE_UNITY_BUILD=%CMAKE_UNITY_BUILD% ^ | ||
| %UTF8PROC_SOURCE% ^ | ||
| %ARROW_SIMD_OPTIONS% ^ | ||
| -DARROW_AZURE=%ARROW_AZURE% ^ | ||
| -DARROW_BUILD_SHARED=ON ^ | ||
| -DARROW_BUILD_STATIC=OFF ^ | ||
|
|
@@ -99,18 +134,15 @@ cmake ^ | |
| -DARROW_WITH_SNAPPY=%ARROW_WITH_SNAPPY% ^ | ||
| -DARROW_WITH_ZLIB=%ARROW_WITH_ZLIB% ^ | ||
| -DARROW_WITH_ZSTD=%ARROW_WITH_ZSTD% ^ | ||
| -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^ | ||
| -DCMAKE_INSTALL_PREFIX=C:\arrow-dist ^ | ||
| -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=%CMAKE_INTERPROCEDURAL_OPTIMIZATION% ^ | ||
| -DCMAKE_UNITY_BUILD=%CMAKE_UNITY_BUILD% ^ | ||
| -DMSVC_LINK_VERBOSE=ON ^ | ||
| -DPARQUET_REQUIRE_ENCRYPTION=%PARQUET_REQUIRE_ENCRYPTION% ^ | ||
| -DVCPKG_MANIFEST_MODE=OFF ^ | ||
| -DVCPKG_TARGET_TRIPLET=%VCPKG_TARGET_TRIPLET% ^ | ||
| -Dxsimd_SOURCE=BUNDLED ^ | ||
| -G "%CMAKE_GENERATOR%" ^ | ||
| -A "%CMAKE_PLATFORM%" ^ | ||
| C:\arrow\cpp || exit /B 1 | ||
| -A %CMAKE_PLATFORM% ^ | ||
| %XSIMD_SOURCE% ^ | ||
| "%ARROW_SRC%\cpp" || exit /B 1 | ||
|
|
||
| cmake --build . --config %CMAKE_BUILD_TYPE% --target install || exit /B 1 | ||
| popd | ||
|
|
||
|
|
@@ -132,10 +164,10 @@ set PYARROW_WITH_PARQUET=%ARROW_PARQUET% | |
| set PYARROW_WITH_PARQUET_ENCRYPTION=%PARQUET_REQUIRE_ENCRYPTION% | ||
| set PYARROW_WITH_SUBSTRAIT=%ARROW_SUBSTRAIT% | ||
| set PYARROW_WITH_S3=%ARROW_S3% | ||
| set ARROW_HOME=C:\arrow-dist | ||
| set CMAKE_PREFIX_PATH=C:\arrow-dist | ||
| set ARROW_HOME=%ARROW_DIST% | ||
| set CMAKE_PREFIX_PATH=%ARROW_DIST% | ||
|
|
||
| pushd C:\arrow\python | ||
| pushd %ARROW_SRC%\python | ||
|
|
||
| @REM Build wheel | ||
| %PYTHON_CMD% -m build --sdist --wheel . --no-isolation || exit /B 1 | ||
|
|
@@ -150,8 +182,17 @@ pushd C:\arrow\python | |
| for /f %%i in ('dir dist\pyarrow-*.whl /B') do (set WHEEL_NAME=%cd%\dist\%%i) || exit /B 1 | ||
| echo "Wheel name: %WHEEL_NAME%" | ||
|
|
||
| %PYTHON_CMD% -m delvewheel repair -vv ^ | ||
| --ignore-existing --with-mangle ^ | ||
| -w repaired_wheels %WHEEL_NAME% || exit /B 1 | ||
| @REM For Windows ARM64, use --add-path to help delvewheel locate and | ||
| @REM bundle native ARM64 DLL dependencies (from vcpkg and pyarrow) | ||
| @REM that are not in standard system locations. | ||
| if "%arch%"=="ARM64" ( | ||
| %PYTHON_CMD% -m delvewheel repair -vv --add-path "%ARROW_DIST%\bin" ^ | ||
| --add-path "C:\vcpkg\installed\arm64-windows\bin" --ignore-existing ^ | ||
| --with-mangle -w repaired_wheels %WHEEL_NAME% || exit /B 1 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The --add-path options are used to help delvewheel locate and bundle native ARM64 DLL dependencies (from vcpkg and pyarrow) that are not in standard system locations. |
||
| ) else ( | ||
| %PYTHON_CMD% -m delvewheel repair -vv ^ | ||
| --ignore-existing --with-mangle ^ | ||
| -w repaired_wheels %WHEEL_NAME% || exit /B 1 | ||
| ) | ||
|
|
||
| popd | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| {% import 'macros.jinja' as macros with context %} | ||
|
|
||
| {{ macros.github_header() }} | ||
|
|
||
| jobs: | ||
| build: | ||
| name: "Build wheel for Windows ARM64" | ||
| runs-on: "{{ runs_on }}" | ||
| timeout-minutes: 240 | ||
| env: | ||
| PYTHON_CMD: "py -{{ python_version }}{% if python_abi_tag.endswith('t') %}t{% endif %}-arm64" | ||
| CMAKE_BUILD_TYPE: release | ||
| steps: | ||
| {{ macros.github_checkout_arrow()|indent }} | ||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "{{ python_version }}{% if python_abi_tag.endswith('t') %}t{% endif %}" | ||
| architecture: "arm64" | ||
|
|
||
| - name: Install Python build dependencies | ||
| shell: cmd | ||
| run: | | ||
| %PYTHON_CMD% -m pip install --upgrade pip | ||
| %PYTHON_CMD% -m pip install -r arrow/python/requirements-wheel-build.txt | ||
| %PYTHON_CMD% -m pip install pandas pytest hypothesis pytz | ||
|
|
||
| - name: Cache vcpkg dependencies | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: C:\vcpkg\installed | ||
| key: "{% raw %}vcpkg-installed-windows-arm64-${{ hashFiles('arrow/ci/vcpkg/vcpkg.json') }}{% endraw %}" | ||
| restore-keys: vcpkg-installed-windows-arm64- | ||
|
|
||
| - name: Install vcpkg dependencies | ||
| shell: cmd | ||
| run: | | ||
| cd arrow\ci\vcpkg | ||
| C:\vcpkg\vcpkg.exe install ^ | ||
| --triplet arm64-windows-static-md ^ | ||
| --binarysource="clear;x-gha,readwrite" ^ | ||
| --x-install-root=C:\vcpkg\installed ^ | ||
| --x-manifest-root=. ^ | ||
| --x-feature=azure ^ | ||
| --x-feature=flight ^ | ||
| --x-feature=json ^ | ||
| --x-feature=gcs ^ | ||
|
MugundanMCW marked this conversation as resolved.
|
||
| --x-feature=orc ^ | ||
| --x-feature=parquet ^ | ||
| --x-feature=s3 | ||
|
|
||
| - name: Build Arrow C++ and PyArrow wheel | ||
| shell: cmd | ||
| env: | ||
| ARCH: "ARM64" | ||
| SETUPTOOLS_SCM_PRETEND_VERSION: "{{ arrow.no_rc_version }}" | ||
| run: | | ||
| call "arrow\ci\scripts\python_wheel_windows_build.bat" | ||
|
|
||
| - name: Test wheel | ||
| shell: cmd | ||
| env: | ||
| ARCH: "ARM64" | ||
| run: | | ||
| call "arrow\ci\scripts\python_wheel_windows_test.bat" | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should also run tests to validate the built wheel is passing tests as we do with all the other wheel jobs.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @raulcd thanks for the review, I have added test suite for Windows ARM64. Please let me if there is any additional changes required. |
||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: wheel | ||
| path: arrow/python/repaired_wheels/*.whl | ||
| {{ macros.github_upload_releases("arrow/python/repaired_wheels/*.whl")|indent }} | ||
| {{ macros.github_upload_wheel_scientific_python("arrow/python/repaired_wheels/*.whl")|indent }} | ||
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.
Can you make sure
CMAKE_PLATFORMis always set?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.
I have modified CMAKE_PLATFORM to set for both x64 and ARM64 as per the build configurations.