Reading time: | 15 min |
Last updated: | 1 May 2025 |
Reading time: |
15 min |
Last updated: |
1 May 2025 |
This guide is intended to get you up and running with this tool quickly with the most common settings. For a thorough review of all options, refer to the official documentation.
PyTorch has native support for Windows on Arm . Starting with PyTorch 2.7 release, you can access Arm native builds of PyTorch for Windows available for Python 3.12.
A number of developer-ready Windows on Arm devices are available.
Windows on Arm instances are available with Microsoft Azure. For further information, see Deploy a Windows on Arm virtual machine on Microsoft Azure .
Before you install PyTorch on your Windows on Arm machine, you will need to install Python version 3.12 for Windows on Arm . Select the Windows ARM64 installer.
Verify your Python installation at a Windows Command prompt or a PowerShell prompt:
python --version
The output should look like:
Python 3.12.9
Once you have downloaded Python, you can install the PyTorch Stable release (2.7.0) on your Windows on Arm machine.
pip3 install torch==2.7.0 --index-url https://download.pytorch.org/whl/cpu
You will see that the arm64
wheel for PyTorch is installed on your machine:
Downloading https://download.pytorch.org/whl/cpu/torch-2.7.0%2Bcpu-cp312-cp312-win_arm64.whl (107.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 107.9/107.9 MB 29.7 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/sympy-1.13.3-py3-none-any.whl (6.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.2/6.2 MB 47.4 MB/s eta 0:00:00
Downloading https://download.pytorch.org/whl/typing_extensions-4.12.2-py3-none-any.whl (37 kB)
Downloading https://download.pytorch.org/whl/filelock-3.13.1-py3-none-any.whl (11 kB)
Downloading https://download.pytorch.org/whl/fsspec-2024.6.1-py3-none-any.whl (177 kB)
Downloading https://download.pytorch.org/whl/Jinja2-3.1.4-py3-none-any.whl (133 kB)
Downloading https://download.pytorch.org/whl/networkx-3.3-py3-none-any.whl (1.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 30.6 MB/s eta 0:00:00
You can also install the nightly preview versions of PyTorch on your Windows Arm machine:
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
To run a PyTorch example and confirm that PyTorch is working, use a text editor to save the code below to a file named pytorch_woa.py
:
import torch
import platform
# Print PyTorch version
print("PyTorch version:", torch.__version__)
# Check if CUDA is available
if torch.cuda.is_available():
print("CUDA is available. PyTorch can use the GPU.")
else:
print("CUDA is not available. PyTorch will use the CPU.")
# Detect system architecture
architecture = platform.machine()
if "ARM" in architecture.upper() or "AARCH" in architecture.upper():
print("PyTorch is running on Arm:", architecture)
else:
print("PyTorch is not running on Arm. Detected architecture:", architecture)
# Perform a basic PyTorch operation to confirm it's working
try:
tensor = torch.tensor([1.0, 2.0, 3.0])
print("PyTorch is operational. Tensor created:", tensor)
except Exception as e:
print("An error occurred while testing PyTorch:", e)
Run the code:
python pytorch_woa.py
Running on a Windows on Arm machine produces an output similar to:
PyTorch version: 2.7.0+cpu
CUDA is not available. PyTorch will use the CPU.
PyTorch is running on Arm: ARM64
PyTorch is operational. Tensor created: tensor([1., 2., 3.])
PyTorch builds for Windows on Arm are CPU-only. CUDA (GPU acceleration) is not supported on this platform.
You are now ready to use PyTorch on your Windows on Arm device.
How would you rate this tool quick-install guide?
What is the primary reason for your feedback ?
Thank you! We're grateful for your feedback.