Get Native Windows Arm64 Python

Please checkout Pre-release Python Installation for instructions

Get the latest source

https://github.com/pytorch/pytorch

Tutorial:https://github.com/pytorch/pytorch#from-source

git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
git submodule sync
git submodule update --init --recursive --jobs 0

Win10 limitation

Starting with Win11, x64 emulation is available for WoA, but for Win10, only x86 host toolchain is available.

We’ve seen that 32-bit linker results in out-of-memory error linking Pytorch.
So the following error is shown if the build is started on Win10:

Warning: 32-bit toolchain will be used, but 64-bit linker is recommended to avoid out-of-memory linker error!
Warning: Please consider upgrading to Win11, where x64 emulation is enabled!

If LLVM is set manually (see below) then the error message is not perfect as the Visual Studio toolchain will be set to 32-bit version, but the manually set toolchain will override that.

Build developer version

python setup.py develop

Build with LLVM

LLVM is not supported explicitly by Pytorch.
However if CMake compiler path is set by environment variables, it’s won’t be overwritten by Visual Studio vcvars settings.

$env:CMAKE_C_COMPILER:PATH="c:\\kg\\tools\\LLVM-14.0.0-rc1-woa64\\bin\\clang-cl.exe"
$env:CMAKE_CXX_COMPILER:PATH="c:\\kg\\tools\\LLVM-14.0.0-rc1-woa64\\bin\\clang-cl.exe"
$env:USE_OPENMP="OFF"
python setup.py develop

Test

python test\test_torch.py