
Microsoft Launches Native PyTorch Builds for Windows on Arm
In a landmark development only weeks after introducing Windows on Arm runner support to GitHub, Microsoft has made a noteworthy announcement for developers targeting Arm-powered devices running Windows. Native builds of PyTorch, a widely-used open-source machine learning framework, are now officially accessible for Windows on Arm. This advancement simplifies the process for developers aiming to build and test applications natively on Arm architecture.
The Significance of PyTorch for Machine Learning
For those unfamiliar, PyTorch serves as a crucial tool for researchers and developers focused on constructing and training deep neural networks. Historically, running PyTorch on Windows devices equipped with Arm chips posed challenges, as users were required to compile the entire framework from source—a process that is time-consuming and less suitable for newcomers to programming.
What’s New in PyTorch 2.7
With the release of PyTorch 2.7, native builds for Windows on Arm are now available for Python 3.12. Developers can easily install PyTorch using a standard package manager such as pip, streamlining the setup process significantly.
According to Microsoft:
This unlocks the potential to leverage the full performance of Arm64 architecture on Windows devices, like Copilot+ PCs, for machine learning experimentation, providing a robust platform for developers and researchers to innovate and refine their models.
Benefits for Machine Learning Development
This latest offering is anticipated to enhance local development, training, and testing of machine learning models directly on Arm-powered Windows machines. Notably, Microsoft highlighted potential applications in areas such as image classification, natural language processing, and generative AI, exemplified by tools like Stable Diffusion.
Getting Started with Native PyTorch on Windows
To get underway with native PyTorch binaries for Windows on Arm, developers must install a few essential prerequisites. This includes components obtained from either the Visual Studio Build Tools or a complete Visual Studio installation.
- Ensure the selection of the Desktop development with C++ workload.
- Make sure to include the latest VS 2022 C++ ARM64/ARM64EC build tools during installation.

Furthermore, installing Rust and having the Arm64 version of Python 3.12 on your system is necessary. Once these prerequisites are fulfilled, a simple command will enable you to install the stable version of PyTorch via pip, targeting the correct download index:
pip install --extra-index-url https://download.pytorch.org/whl torch
Exploring Nightly Builds
For those eager to experiment with the latest features and who are comfortable with potentially unstable versions, the Nightly or Preview builds can be installed using the following command:
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
Additional Native Builds and Best Practices
In addition to the Python package, native builds for LibTorch, which serves as PyTorch’s C++ front-end often employed in deployment contexts, are also made available. For a comprehensive guide on getting started with LibTorch, developers can visit the PyTorch website. As standard practice for Python development, Microsoft advises creating a Virtual Environment (venv) to manage project dependencies seamlessly and avoid potential conflicts.
Example Application and Adoption
Furthermore, Microsoft has showcased an example of using the native PyTorch binaries for Stable Diffusion on Windows on Arm, providing insights on how developers can leverage generative AI in their applications. The relevant code can be found in this GitHub repository.
Addressing Dependency Challenges
It is essential to note that while PyTorch and LibTorch now support native binaries for Windows on Arm, not all dependencies may follow suit. Some additional Python packages, particularly those with performance-sensitive components written in languages such as C, C++, or Rust, might not yet offer pre-compiled native Arm64.whl files on PyPI. Hence, a straightforward pip install may not yield a native version for each library in use.
However, pip can install dependencies directly from source code distributions often provided as.tar.gz files. If the appropriate build tools are present on your system—reinforcing the earlier mention of MSVC with the Arm64 toolchain and Rust—pip can compile these packages into Windows-compatible.whl files locally.
Microsoft highlighted that this method allows the installation of specific versions of popular packages, such as NumPy 2.2.3 and safetensors 0.5.3, showcasing the commands required:
pip install numpy==2.2.3 # and pip install safetensors==0.5.3
These commands serve as examples of how to compile packages from the source effectively.
Read More
For further insights and additional examples, refer to the complete announcement on the Microsoft Windows Blog.
Leave a Reply ▼