Install Packages

This page explains how to install python packages for Windows Arm64 with pip and pypi repository.

Many of the python packages still doesn't provide binary wheels for Windows Arm64 targets and pip will be locally building and installing packages with the help of source distributions provided for each package. This means we will have to have toolchain, build tools and other libraries required for building from source locally, otherwise pip install will fail.

Dependencies

Majority of the packages with C/C++ code would at least need a Visual studio installation with ARM64 toolchain. And some packages might require LLVM toolchain, rust, cmake and may be other dependencies. Dependencies listed in the following section covers majority of the tools used by popular python packages.

Visual Studio Installation

It is recommended to use Visual Studio 2022 Community version with the following components.

Make sure you have “Desktop development with C++” selected in the workloads tab, and then use the “Individual components” tab to select the following Arm64 components for Visual Studio:

  • C++ Universal Windows Platform support for v143 build tools (ARM64)

  • MSVC v143 - VS 2019 C++ x64/x86 build tools (latest)

  • MSVC v143 - VS 2019 C++ ARM64 build tools (latest)

  • MSVC v143 - VS 2019 C++ ARM64 Spectre-mitigated libs (latest)

  • C++ ATL for latest v143 build tools (ARM64)

  • C++ ATL for latest v143 build tools with Spectre Mitigations (ARM64)

  • C++ MFC for latest v143 build tools (ARM64)

  • Windows 10 SDK (10.0.22000.0)

  • Workload: Desktop development with C++ (this is essential to get a working env with vcvarsall)

This will setup MSVC compiler toolchain, runtimes, windows SDK, etc. required for most of our development.

You can also use Build Tools instead of Visual Studio. It allows you to select which toolchain you want, and you can even skip Visual Studio installation completely.

Build Tools 2022

Build Tools 2019

Install MSVC C++ Redistributables

This is the download page: https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads

Make sure you download and install the Arm64 version of the Visual C++ Redistributable: vc_redist.arm64.exe

LLVM Toolchain

It is recommended to download and install the latest LLVM version.

https://github.com/llvm/llvm-project/releases/

Windows Arm64 package has woa64 suffix.

CMake

Recommended to install Windows Arm64 native CMake.

It is available from version 3.24

https://github.com/Kitware/CMake/releases

Vcpkg

A package manager maintained by Microsoft and community. It supports win/arm64 and has many libraries required for python packages.

https://vcpkg.io/

Installation

git clone ./vcpkg/bootstrap-vcpkg.sh

Package installation (e.g: openssl)

vcpkg.exe install --triplet arm64-windows openssl

Git

It is recommended to install latest version of Git for Windows

Rust

Download installer from: https://win.rustup.rs/x86_64

Install toolchain:

rustup-init.exe --default-toolchain stable --default-host aarch64-pc-windows-msvc

Installer should add cargo to your PATH automatically (--no-modify-path if you don’t want).

Perl

Msys2

Package Installation

With above dependencies installed on your system, It is possible to install majority of the python package with the pip command.

Example:

pip install numpy

pip will download the source package from PyPi repository and will compile the binaries and install them on your system.

Some packages might require some extra dependencies and manual steps, contains instructions to build specific packages manually.

pip by default install packages in an isolated environment and any package dependencies already installed will be ignored and will be installed in the isolated environment. This might become an issue if one of the dependencies require special handling and needs to be installed manually. It is recommended to use --no-build-isolation flag to pip to avoid using isolated environment and to use packages already installed on your environment

pip install --no-build-isolation <package>