cryptography icon indicating copy to clipboard operation
cryptography copied to clipboard

Wheel for Windows on arm64

Open wezm opened this issue 1 year ago • 20 comments

There was previous discussion in #8148 regarding a Windows on ARM wheel. That was closed with these comments:

We won't ship a wheel for a platform we can't test in CI and GitHub does not currently offer arm64 windows runners. When they do we'll revisit this though! (see: https://github.com/pyca/pynacl/issues/775 for some past discussion in another repo we own)

and

In the absence of some indication from gh that this is even on their roadmap, this is pretty inacationable for us, so I'm going toclose.

GitHub have announced arm runners: https://github.blog/2024-06-03-arm64-on-github-actions-powering-faster-more-efficient-build-systems/ and as an owner of one of the new Snapdragon X ARM laptops I'm keen to simplify installation on this system.

wezm avatar Jul 05 '24 10:07 wezm

Github has arm64 Linux runners. They have not made any arm64 Windows runners available here, so there's nothing for us to do yet.

alex avatar Jul 05 '24 12:07 alex

That’s not quite correct. They did announce both Linux and windows , but no OSS access for either.

If/when they extend support to OSS we’ll potentially revisit this. It is unfortunate that one part of MS is pushing a new architecture so heavily while another isn’t ready.

reaperhulk avatar Jul 05 '24 12:07 reaperhulk

Ah, my mistake. Well, we're still waiting.

On Fri, Jul 5, 2024 at 8:44 AM Paul Kehrer @.***> wrote:

That’s not quite correct. They did announce both Linux and windows , but nomOSS access for either.

If/when they extend support to OSS we’ll potentially revisit this. It is unfortunate that one part of MS is pushing a new architecture so heavily while another isn’t ready.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

-- All that is necessary for evil to succeed is for good people to do nothing.

alex avatar Jul 05 '24 13:07 alex

Hi, I am not well versed to installing packages for Python outside of using pip install.

Is there a way to install cryptography on a WoA machine with manual work involved?

Thanks.

The-Aurora avatar Sep 22 '24 15:09 The-Aurora

As long as you have the requisite dependencies installed (OpenSSL and rust), pip install cryptography will automatically build from source.

alex avatar Sep 22 '24 15:09 alex

You'll need vcpkg installation and vcpkg install openssl --target arm64-windows-static-md, that should allow local build.

saschanaz avatar Sep 22 '24 15:09 saschanaz

Thanks,

I have installed openssl manually and apparently I somehow clicked on "cancel" instead of "OK" when setting the OPENSSL_DIR env variable. As I noticed it was missing.

I then tried using vcpkg and set the VCPKG_ROOT variable to C:\vcpkg and that also didn't work. After using OPENSSL_DIR = "C:\vcpkg\installed\arm64-windows-static" (meant to use VCPKG_ROOT), it installed.

A rookie mistake I am sure that comes with not using something.

However, confirmation that going through the vcpkg route should work, made me to go through everything so thanks!

The-Aurora avatar Sep 22 '24 15:09 The-Aurora

Here we can keep track:

https://github.com/github/roadmap/issues/970

CanePlayz avatar Oct 28 '24 18:10 CanePlayz

Runners are now planned for Q1 2025

CanePlayz avatar Jan 02 '25 00:01 CanePlayz

I'm very excited, and will believe it when I see it :-)

alex avatar Jan 02 '25 00:01 alex

Is cross compilation infeasible?

ofek avatar Mar 04 '25 21:03 ofek

We, as a general policy, do not build wheels for platforms we don't test. There have been (very rare) exceptions to this, but we'll be waiting for GitHub (which, as a reminder, is a Microsoft-owned company!) to ship OSS Windows arm64 builders before we add wheels.

reaperhulk avatar Mar 04 '25 22:03 reaperhulk

This has (unsurprisingly) been deferred to Q2: https://github.com/github/roadmap/issues/1098

alex avatar Mar 24 '25 16:03 alex

The new ARM runners are live as of yesterday. I think you have to cross-compile, though, as there's no binaries for rustup for windows ARM. I think you'll want to cross-compile for Windows ARM (which is easy), then test the wheels on the native runner.

(Because of the problems compiling Rust directly, this makes it really hard to use cryptography without pre-compiled wheels). I think I've managed to work around needed cryptography in https://github.com/pypa/cibuildwheel/pull/2362.

henryiii avatar Apr 15 '25 05:04 henryiii

there's no binaries for rustup for windows ARM.

There is: https://win.rustup.rs/aarch64

wezm avatar Apr 15 '25 05:04 wezm

Oh, I tried both setup-rust actions and they reported no rustup command found, and I thought it was missing. That's great, so I just don't know how to activate it on the ARM runners.

henryiii avatar Apr 15 '25 05:04 henryiii

I thought it was https://rust-lang.github.io/rustup-components-history/arm64ec-pc-windows-msvc.html, it it actually https://rust-lang.github.io/rustup-components-history/aarch64-pc-windows-msvc.html?

henryiii avatar Apr 15 '25 05:04 henryiii

Let's get this train rolling. Step 1, build OpenSSL: https://github.com/pyca/infra/pull/686

alex avatar Apr 15 '25 13:04 alex

FYI, I believe 3.9 is the oldest CPython supporting Windows on ARM (noticed 3.7 in the CI).

henryiii avatar Apr 15 '25 13:04 henryiii

https://github.com/actions/partner-runner-images/issues/77 tracks getting rustup in the images themseles

alex avatar Apr 15 '25 13:04 alex

I found myself blocked on this problem, when trying to set up Windows 11 ARM buildbot CI test runners for the Emscripten project.

Just wanted to comment that the following worked out as a workaround:

As long as you have the requisite dependencies installed (OpenSSL and rust), pip install cryptography will automatically build from source.

The steps here being

C:\>cd code
C:\code>git clone https://github.com/microsoft/vcpkg.git
C:\code>cd vcpkg
C:\code\vcpkg>bootstrap-vcpkg.bat
C:\code\vcpkg>setx VCPKG_ROOT C:\code\vcpkg
# Go in Advanced System Settings to add c:\code\vcpkg entry in PATH
C:\code\vcpkg>vcpkg install openssl --triplet arm64-windows-static-md
C:\code\vcpkg>setx OPENSSL_DIR C:\code\vcpkg\installed\arm64-windows-static-md
# Open new command prompt:
C:\code\vcpkg>pip install cryptography

Maybe that can be of help to anyone googling their way into this error message.

juj avatar Jun 25 '25 21:06 juj

That way the build works, but eventually will give you https://github.com/openssl/openssl/issues/27030

saschanaz avatar Jun 25 '25 22:06 saschanaz

Ah, that's good to know. In my use case I shouldn't be using HTTPS or SSL at all.. just http://localhost communication. Hopefully that'll avoid running into that crash issue.

juj avatar Jun 25 '25 22:06 juj