Skip to content

ENH: Provide Windows 11 ARM64 wheels (#22530)#28836

Merged
charris merged 3 commits intonumpy:mainfrom
HinTak:windows-arm64-support
May 7, 2025
Merged

ENH: Provide Windows 11 ARM64 wheels (#22530)#28836
charris merged 3 commits intonumpy:mainfrom
HinTak:windows-arm64-support

Conversation

@HinTak
Copy link
Copy Markdown
Contributor

@HinTak HinTak commented Apr 26, 2025

This is mostly adapting and duplicating how the 32-bit no-OpenBLAS wheels are built, to make ARM64 wheels.

The mamba-org/setup-micromamba github action reports "win_arm64" as unsupported for installation of anaconda-client at the moment.

Beyond that, a number of tests need to be skipped. They are in three categories:
- Meson outside of the msdevshell github action does not seems to be able to find the MSVC linker. (Possibly missing some PATH env)
- No "checks" modules in win-arm64 (yet)
- Mingw GNU objdump does not understand arm64 dll format (yet) to to generate import libraries.

closes #22530

This is mostly adapting and duplicating how the 32-bit no-OpenBLAS
wheels are built, to make ARM64 wheels.

The mamba-org/setup-micromamba github action reports "win_arm64" as
unsupported for installation of anaconda-client at the moment.

Beyond that, a number of tests need to be skipped. They are in
three categories:
    - Meson outside of the msdevshell github action does not seems
      to be able to find the MSVC linker. (Possibly missing some PATH env)
    - No "checks" modules in win-arm64 (yet)
    - Mingw GNU objdump does not understand arm64 dll format (yet) to
      to generate import libraries.

closes numpy#22530
@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 26, 2025

Quite sure that the failed "Linux tests / pypy (pull_request)" test is unrelated - none of this set of changes touches linux builds...

@charris
Copy link
Copy Markdown
Member

charris commented Apr 26, 2025

the failed "Linux tests / pypy (pull_request)" test is unrelated

It is a known bug in PyPy.

Copy link
Copy Markdown
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

Thanks for working on this @HinTak! This looks pretty good, glad to hear that the msdevshell action just works and that almost all tests are passing.

The mamba-org/setup-micromamba github action reports "win_arm64" as unsupported for installation of anaconda-client at the moment.

That is expected; core conda ecosystem tools are currently being bootstrapped, they're not yet available. A little annoying that we have to skip nightly wheel build uploads due to that, since nightly wheels will be useful for the early adopters to test. We can see if we can run an x86-64 version of anaconda-client for the time being.

Mingw GNU objdump does not understand arm64 dll format (yet) to to generate import libraries.

Let's not worry about numpy.distutils, that's too much trouble since it's already deprecated and will be removed completely once we drop Python 3.11 support. Instead of messing with this, let's just not install numpy.distutils at all on win-arm64. All it takes is amending this skip condition:

if py.version().version_compare('<3.12')

Could you give that a try?

Meson outside of the msdevshell github action does not seems to be able to find the MSVC linker. (Possibly missing some PATH env)

Could you add the content of a test failure in a comment on this PR? I'll see if I can help resolve this one.

@rgommers
Copy link
Copy Markdown
Member

Had a look at the CI log. This all looks as expected indeed:

   Build type: native build
  Project name: NumPy
  Project version: 2.3.0.dev0+git20250426.a4cb24a
  C compiler for the host machine: cl (msvc 19.43.34808 "Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34808 for ARM64")
  C linker for the host machine: link link 14.43.34808.0
  C++ compiler for the host machine: cl (msvc 19.43.34808 "Microsoft (R) C/C++ Optimizing Compiler Version 19.43.34808 for ARM64")
  C++ linker for the host machine: link link 14.43.34808.0
  Cython compiler for the host machine: cython (cython 3.0.12)
  Host machine cpu family: aarch64
  Host machine cpu: aarch64

SIMD support may not yet be a thing, or detection fails - not urgent right now, but will require follow-up:

  Test features "NEON NEON_FP16 NEON_VFPV4 ASIMD" : Supported
  Test features "ASIMDHP" : Unsupported due to Implied feature "NEON" is not supported
  Test features "ASIMDFHM" : Unsupported due to Implied feature "NEON" is not supported
  Test features "SVE" : Unsupported due to Implied feature "NEON" is not supported

only the baseline features are used in the build:

     baseline:
      Requested : min
      Enabled   : NEON NEON_FP16 NEON_VFPV4 ASIMD

@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 26, 2025

The mesa stdout message is:

  ---------------------------- Captured stdout setup ----------------------------
  The Meson build system
  
  Version: 1.7.2
  
  Source dir: C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\popen-gw0\test_cstruct0\array_interface_testing
  
  Build dir: C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\popen-gw0\test_cstruct0\array_interface_testing\build
  
  Build type: native build
  
  Project name: foo
  
  Project version: undefined
  
  
  
  ..\meson.build:1:0: ERROR: Found GNU link.exe instead of MSVC link.exe in C:\Program Files\Git\usr\bin\link.EXE.
  
  This link.exe is not a linker.
  
  You may need to reorder entries to your %PATH% variable to resolve this.
  
  
  
  A full log can be found at C:\Users\runneradmin\AppData\Local\Temp\pytest-of-runneradmin\pytest-0\popen-gw0\test_cstruct0\array_interface_testing\build\meson-logs\meson-log.txt

The correct path value (earlier from the msdevshell step is):

 Path
Value : C:\Program Files\Microsoft Visual 
        Studio\2022\Enterprise\VC\Tools\MSVC\14.43.34808\bin\HostARM64\ARM64;C:\Program Files\Microsoft Visual 
        Studio\2022\Enterprise\Common7\IDE\VC\VCPackages;C:\Program Files\Microsoft Visual 
        Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files\Microsoft Visual 
        Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program 
        Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\bin\Roslyn;C:\Program Files (x86)\Microsoft 
        SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files\Microsoft 
        Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools;C:\Program Files\Microsoft 
        Visual Studio\2022\Enterprise\Team Tools\DiagnosticsHub\Collector;C:\Program Files\Microsoft Visual 
        Studio\2022\Enterprise\Common7\IDE\Extensions\Microsoft\CodeCoverage.Console;C:\Program Files (x86)\Windows 
        Kits\10\bin\10.0.26100.0\\arm64;C:\Program Files (x86)\Windows Kits\10\bin\\arm64;C:\Program Files\Microsoft 
        Visual 
        Studio\2022\Enterprise\\MSBuild\Current\Bin\arm64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Program 
        Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\;C:\Program Files\Microsoft Visual 
        Studio\2022\Enterprise\Common7\Tools\;C:\Program Files\PowerShell\7;C:\aliyun-cli;C:\vcpkg;C:\Program Files 
        (x86)\NSIS\;C:\Program Files\Mercurial\;C:\hostedtoolcache\windows\stack\3.3.1\x64;C:\mingw64\bin;C:\Program 
        Files\dotnet;C:\Program Files\MySQL\MySQL Server 8.0\bin;C:\Program Files (x86)\R\R-4.4.2\bin\x64;C:\SeleniumWe
        bDrivers\GeckoDriver;C:\SeleniumWebDrivers\EdgeDriver\;C:\SeleniumWebDrivers\ChromeDriver;C:\Program Files 
        (x86)\sbt\bin;C:\Program Files (x86)\GitHub CLI;C:\Program Files\Git\bin;C:\Program Files (x86)\pipx_bin;C:\npm
        \prefix;C:\hostedtoolcache\windows\go\1.21.13\arm64\bin;C:\hostedtoolcache\windows\Python\3.9.13\x64\Scripts;C:
        \hostedtoolcache\windows\Python\3.9.13\x64;C:\hostedtoolcache\windows\Ruby\3.0.7\x64\bin;C:\Program Files\OpenS
        SL\bin;C:\tools\kotlinc\bin;C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\8.0.442-6\x64\bin;C:\Program 
        Files (x86)\ImageMagick-7.1.1-Q16-HDRI;C:\Program Files\Microsoft SDKs\Azure\CLI2\wbin;C:\ProgramData\kind;C:\P
        rogramData\Chocolatey\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPo
        werShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PowerShell\7\;C:\Program Files\Microsoft\Web 
        Platform Installer\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program 
        Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL 
        Server\[130](https://github.com/HinTak/numpy/actions/runs/14681173130/job/41204101146#step:4:132)\DTS\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files\Microsoft SQL 
        Server\150\DTS\Binn\;C:\Program Files\Microsoft SQL Server\160\DTS\Binn\;C:\Strawberry\c\bin;C:\Strawberry\perl
        \site\bin;C:\Strawberry\perl\bin;C:\ProgramData\chocolatey\lib\pulumi\tools\Pulumi\bin;C:\Program 
        Files\CMake\bin;C:\ProgramData\chocolatey\lib\maven\apache-maven-3.9.9\bin;C:\Program Files\nodejs\;C:\Program 
        Files\Git\cmd;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\GitHub 
        CLI\;c:\tools\php;C:\Program Files (x86)\sbt\bin;C:\Program Files\Amazon\AWSCLIV2\;C:\Program 
        Files\Amazon\SessionManagerPlugin\bin\;C:\Program Files\Amazon\AWSSAMCLI\bin\;C:\Program Files\Microsoft SQL 
        Server\130\Tools\Binn\;C:\Program Files\LLVM\bin;C:\Users\runneradmin\.dotnet\tools;C:\Users\runneradmin\AppDat
        a\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft Visual 
        Studio\2022\Enterprise\VC\Tools\Llvm\ARM64\bin;C:\Program Files\Microsoft Visual 
        Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files\Microsoft 
        Visual Studio\2022\Enterprise\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files\Microsoft 
        Visual Studio\2022\Enterprise\Common7\IDE\VC\Linux\bin\ConnectionManagerExe;C:\Program Files\Microsoft Visual 
        Studio\2022\Enterprise\VC\vcpkg

I think there is some sort of vc init .bat that one can run manually to set PATH to work. Maybe the meson people need to update? There is another issue filed on the runner image about meson not being native, I think.

Arm windows can run x86_64 binaries, btw.

@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 26, 2025

C:\Program Files\Git\usr\bin is about 3/4 of the way down from the PATH Value - so everything before it was added by msdevshell!

@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 26, 2025

...Instead of messing with this, let's just not install numpy.distutils at all on win-arm64. All it takes is amending this skip condition:

if py.version().version_compare('<3.12')

Could you give that a try?

Adding this part resulting in the sdist part of the wheel builder ci failing, as it runs python 3.11 and misses the distutils module:

File "<string>", line 1, in <module>
  File "/opt/hostedtoolcache/Python/3.11.12/x64/lib/python3.11/site-packages/numpy/_pytesttester.py", line 144, in __call__
    from numpy.distutils import cpuinfo
ModuleNotFoundError: No module named 'numpy.distutils'
2.3.0.dev0+git20250426.5d7780c

The ci logs is in my fork (i am just adding the changes there to see if it works first) - I think the detailed log is visible to others?

@rgommers
Copy link
Copy Markdown
Member

I think there is some sort of vc init .bat that one can run manually to set PATH to work.

This is exactly what the msdevshell action is supposed to take care of.

Maybe the meson people need to update?

I can't find a relevant issue upstream. I suspect it's the msdevshell not actually doing the right thing yet.

Adding this part resulting in the sdist part of the wheel builder ci failing, as it runs python 3.11 and misses the distutils module:

It shouldn't affect the sdist generation in CI if you add or (is_windows and host_machine.cpu_family != 'aarch64').

The ci logs is in my fork (i am just adding the changes there to see if it works first) - I think the detailed log is visible to others?

Yes they are, I looked at one of your logs before. If you want to point out something specific, you can link to the log directly.

@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 27, 2025

@rgommers I meant that msdevshell's effect does not seem to carry on all the way to the pytest stage - so PATH was correct early on, but got overwritten / undo / reset later just before pytest . I 'll have another go at the distutils and see if I can get around it.

@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 27, 2025

This is the log of an earlier run with the meson related failure - https://github.com/HinTak/numpy/actions/runs/14681173130/job/41204101148 - if you can see anything interesting there? @rgommers

@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 28, 2025

I see the vendor-meson submodule has been updated in main - anybody think that might possibly address the meson msvc issue?

@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 28, 2025

It shouldn't affect the sdist generation in CI if you add or (is_windows and host_machine.cpu_family != 'aarch64').

The conditional failed even worse - I am trying
and not (is_windows and host_machine.cpu_family == 'aarch64') now... I think that's the intention : skip putting the distutils dir on arm windows regardless of python version - it affects python 11 + arm windows only anyway?

@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 28, 2025

Changing that conditional on sdist https://github.com/HinTak/numpy/actions/runs/14697380294 means the wheel building fails at a different place. So far the changes here is what "works"... I'd like to see the meson + msvc linker look up at pytest works ( just an idea: is the testing itself overwriting PATH by pretending the git dir to PATH?), but that may take some effort from somebody else more knowledgeable.

AFAIK skia-python doesn't use numpy via meson, so this should be useful as is, when merged into a release, for us to put skia-python arm windows support out.

@rgommers
Copy link
Copy Markdown
Member

I see the vendor-meson submodule has been updated in main - anybody think that might possibly address the meson msvc issue?

That is unlikely, it was a minor update.

This is the log of an earlier run with the meson related failure - log-link - if you can see anything interesting there?

Thanks. No, the NumPy code looks fine I think, and nothing jumps out. It's probably indeed PATH ordering, just not sure why it's only a problem on the win-arm64 runners.

I'll try to find time to have a closer look.

I am trying
and not (is_windows and host_machine.cpu_family == 'aarch64') now... I think that's the intention : skip putting the distutils dir on arm windows regardless of python version - it affects python 11 + arm windows only anyway?

👍🏼

@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented Apr 29, 2025

Modifying the sdist part results in failing like this, for python 3.11 arm windows:

File "C:\Users\runneradmin\AppData\Local\Temp\cibw-run-svwpgm_8\cp311-win_arm64\venv-test\Lib\site-packages\numpy\_pytesttester.py", line 144, in __call__
      from numpy.distutils import cpuinfo
  ModuleNotFoundError: No module named 'numpy.distutils'
  Error: Command bash C:\a\numpy\numpy/tools/wheels/cibw_test_command.sh C:\a\numpy\numpy failed with code 1. 

I guess the tester can be modified to allow missing import, but IMHO that isn't better than the little skip here. I think there is a chance the skip will work with a later mingw.

@rgommers
Copy link
Copy Markdown
Member

rgommers commented May 5, 2025

I guess the tester can be modified to allow missing import, but IMHO that isn't better than the little skip here. I think there is a chance the skip will work with a later mingw.

Okay, I won't be able to dig in deeper here, so let's go with the skip for now.

This looks about ready. The one thing I'm doubting is whether we should merge the wheel build part, since it's going to be quite slow without OpenBLAS. But perhaps it's still better than nothing - not many people will be able to build with a BLAS library from scratch anyway. So I think I'm okay with merging this and then updating after MacPython/openblas-libs#193 lands to provide scipy-openblas64 wheels. I'll ask about this on the linked issue, which more relevant folks are watching.

@seberg seberg added this to the 2.3.0 release milestone May 7, 2025
@charris charris merged commit 2a083e3 into numpy:main May 7, 2025
74 checks passed
@charris
Copy link
Copy Markdown
Member

charris commented May 7, 2025

I've put this in. The OpenBLAS builds look to be making progress.

@charris
Copy link
Copy Markdown
Member

charris commented May 7, 2025

Thanks @HinTak.

@HinTak HinTak deleted the windows-arm64-support branch May 7, 2025 18:48
@HinTak
Copy link
Copy Markdown
Contributor Author

HinTak commented May 7, 2025

Thanks!

@khmyznikov
Copy link
Copy Markdown

When it will be available on PyPi?

@rgommers
Copy link
Copy Markdown
Member

With NumPy 2.3.0, probably at the end of June or in July.

@khmyznikov
Copy link
Copy Markdown

@rgommers Let me know if any help is needed to make it sooner than July. NumPy is an essential package and a build dependency for many others.

@rgommers
Copy link
Copy Markdown
Member

Thanks for the offer @khmyznikov. There isn't much to do to speed it up though - we have feature releases twice a year. The next one is 2.3.0; the release candidate for it should be up on PyPI much sooner, so downstream projects willing to use a pre-release will be unblocked soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: Provide Windows ARM64 wheels

5 participants