-
-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows 10 ARM64 platform support #77306
Comments
The Windows 10 ARM64 release is out along with a bunch of ARM64 devices. This version of Windows has full support for building native Win32 applications (this isn't just some rehash of Windows RT). It also can run x86 (but not x86_64) apps under a transparent emulation layer. I would like to see a native build of Python on Windows 10 ARM64. I did some very basic work to get it compiling (add 10.0.16299.0 as DefaultWindowsSDKVersion, add WindowsSDKDesktopARM64Support property). But there's still a lot missing: ssl, tk, and ctypes don't build. ssl/ctypes have some assembly that needs writing/porting. tk has some kind of build failure with the newer Windows SDK: https://core.tcl.tk/tk/tktview?name=3d34589aa0 |
Oh, another change I had to make was remove all the BaseAddress elements in the Link sections. The linker complains if these are used (the lower 4GB of memory are apparently reserved for the x86 emulation). Also, from what I was told by someone over at Microsoft, the BaseAddress options don't do anything useful on modern Windows versions unless you build with -fixed as well, because everything gets relocated anyway. |
I'd like to see this as well, but just to set expectations, it can't be any earlier than 3.8 at this stage (for upstream support), and we need access to some real hardware to regularly run tests on. That said, most of the changes you describe are on my list of things to do anyway. If you've done them and would like to submit a pull request (against master) then we'll happily take them now and include them in 3.7. But you'll still need to build the ARM versions yourself. |
I originally tagged this issue against 3.6 just because that's what I was attempting to build. But I'm not super concerned about what release these changes actually land in, I can always backport it to my own builds (and at my own risk). Even though I'm super interested in seeing these changes done, I'm not sure I'm the right person to do the heavy lifting on this. I don't know if the seemingly undocumented (?) Windows ARM64 ABI matches the well-documented Linux AArch64 ABI, for example. If it does match, that would make porting the asm bits pretty straightforward (mostly just translating GNU assembler AT&T syntax to MASM, I suppose). I could do that. But if it doesn't match then I'd probably need to dig into ARM architecture manuals. Someone else could likely do it in their sleep. |
Ideally, all of the changes necessary in OpenSSL, libffi, and Tcl/Tk will happen upstream and we'll just update to new versions of them. We have PR 3806 in progress to extract libffi from our repo and treat it just as any other external dependency on Windows, but neither Steve nor I have had a chance to work on it in quite a long time. That will probably be a prerequisite for properly supporting ARM64 Windows. |
I'm interested in getting python working on Windows running on Raspberry Pi (Thumb-2 instruction set). I can also contribute to ARM64 Windows. I've made some progress getting ARM32 working on a fork. The next roadblock for my investigation is libffi support for ARM32 on Windows. Can I help with that? |
If libffi already has support and just needs to be updated in CPython, then sure. I thought we'd finished extracting it, but Zach posted aPR link above that apparently still needs finishing. However, if libffi doesn't have the support yet then you'll have to approach them. |
The PR hasn't changed since September. Is it still active? Should I consider updating the libffi_msvc code to support ARM32 in Python? Completing the switch to libffi makes more sense to me. I fetched the PR code to my fork and rebased it on the current master branch. When I run python -m test there are 2 tests that fail. Is that what's holding the PR up? or is it something more? I'm new to the Python codebase but I can try to help debugging if the failing tests are the issue. |
Hi, For ctypes I used the (then most) latest version of libffi. There's an msvc_build directory in the master branch which allows ARM64 builds. With the library working the ctypes module builds just fine (BTW from looking at the libffi code it seems that the code is a straightforward port from the Linux ARM64 code, which is generally fine since Windows on ARM seems to use the standard ARMv8 ABI but who knows what end cases may occur). For SSL, I managed to compile OpenSSL with a lot of headache. Also as noted I had to give-up on ASM optimizations so the ssl module may not be as fast as the native i686, however it will probably still be way faster than x86 emulation mode. For TCL/TK I compiled the TCL/TK libraries from source as well. There's an issue with compiling that on MSVC 2015 because apparently the source uses some names which are now reserved keywords on the newer compiler so some search & replace is needed but once the module is built the Python modules compile just fine. Overall this is a pretty much complete Python 2.7 package as it has all modules usually shipped built-in compiled and seemingly working (as far as I tested). The whole thing took several days but if you want to port it to Python 3.8 it shouldn't be too difficult and I'll gladly share my (very slightly) modified sources with you if you wish. |
I just added a PR that will produce ARM64 releases (as embeddable, nuget and Microsoft Store packages). The only missing feature is tkinter (and everything that depends on it). For users who require that, I'd suggest grabbing the x86 installer from python.org which works fine (apart from some minor arithmetic and process management bugs in the Windows emulation layer). This is not saying we're going to release it just yet. Really it shouldn't be released until 3.9, as it's a new platform and we need to allow the 3rd party package ecosystem to catch up, but at least having the ability to build packages easily will enable those who are already trying to do it themselves. Allegedly there's a lot of demand for Python on ARM64, but I haven't actually seen it other than this bug. And if that demand immediately extends to numpy or pywin32 on ARM64 then we're still a very long way from actually satisfying it. I'll likely tweak the PR a bit more to prevent releasing ARM64 packages by default, but then I don't see any issue having it in the 3.8 and master branches for those who would be helped. Any thoughts/comments? |
Steve, the 2.7 build I've posted includes native tk, do you need the necessary patches? |
If the patches are for Tcl/Tk, then you should submit it to them. I'm not a Tk maintainer, and I never want to be one, so frankly I'd be happier to say it's not supported on ARM :) But if it builds fine with our PCbuild/prepare_tcltk.bat script and people want it then I'll keep it. |
According to this - |
I've merged the change to master, but note that the release is not enabled, so we aren't actually releasing ARM64 builds yet (though they will be compiled [but not tested] in PRs - nothing should be different from other Windows builds though). There's no harm in giving the build scripts a bit of bake time. I'm also not concerned about backporting to 3.8 to make it easier to build that version, which I've heard a little bit of demand for. But let's run the scripts in master for a little while first. Deliberately leaving the stage as "commit review" rather than "backport needed" for now. |
I also filed bpo-38867 specifically for enabling Tkinter on Windows ARM. |
Closing this as the work we need for support is now added. Whether we start releasing binaries from python.org is a discussion to have on python-dev and with the broader community. Right now, I don't think the ecosystem is ready to add support (mainly because there is no CI system that can build/test easily). And most of our tooling isn't up to the task either. Until that can be improved, it's not fair to expect third party packagers to provide wheels or support the platform. |
This site seems like a pretty good aggregation of news around Windows on ARM64 devices: https://www.windows-arm.com/ Short story is, it's a real thing, but for (what I consider) obvious reasons the OSS developer experience isn't great yet. |
Requesting that this issue be re-opened or re-evaluated; it would be pretty great if Python could provide Windows on ARM binaries for download. There's been a lot of traction on ARM in general and having Windows on ARM downloads available by default will also give the Python package ecosystem a better opportunity to get ready (although it's already impressively far ahead, take a look at https://cloudbase.it/python-on-windows-arm64/, 23 of 25 of the most popular packages already build out-of-the-box, and the remaining two, numpy and cffi have patches available). |
Our builds are fine, so there's no need for an issue on our side. The decision to release is based on the ecosystem catching up. If you're able to help projects like setuptools, pip, and the core parts of the data science stack (which will need the most help) be able to support ARM64 builds (despite the current lack of CI/CD support, which I'm working on separately), that will accelerate us being able to make the ARM64 releases available/supported. |
I know this is closed, but is it possible that the ARM64EC support coming in Windows 11 that allows mixed native/emulated code is something that would help this along? That along with the sunsetting of 32-bit systems. |
I'm sure it will help, but official support will continue to be blocked by availability of CI/CD systems for first- and third-party packages/testing. |
I know this issue is closed but just wanted to have a discussion around adding CI support for cpython on windows on arm targets. We at linaro are working on adding windows/arm support for popular packages such as numpy, cffi etc. Hopefully, very soon we will have many of the popular packages working out of the box on windows on arm targets. Testing windows/arm has been an open question. I heard about the potential availablity of windows/arm machines in azure cloud sometimes in the future but not sure about the timescale. In Linaro, we have a WoA farm which has couple of surface pro which we are happy to use for CI and for release builds etc. It could be an interim testing system until we have support in azure. This would enable us to start official support for cpython for windows/arm sooner. I would like to hear your thoughts on the proposal |
Hi Python peeps,
It sounds to me like all stars are aligned for a Windows on ARM64 release, it would be rather great if this could happen! |
Python buildbot worker for woa is up and running as well https://buildbot.python.org/all/#/workers/45 Would be great to see official support and installer added for woa |
Yeah, we're getting close. I'll reopen this issue for tracking. We still need that pip release and it'll have to be merged into ensurepip. We'll also need better access to test systems than any of us currently have (the buildbot is great, but we need interactive systems too). There are already binary releases at https://www.nuget.org/packages/pythonarm64/ that should be suitable for most testing. I'll probably make the ARM64 packages available through the Windows Store for 3.11's prereleases, and possibly as a side-loadable MSIX from python.org. I'm strongly considering not offering the regular executable installer on ARM64, since it seems we don't have the back-compat demand right now. It would be a good opportunity to try and fix the issues with that installer and really put the focus on the MSIX as the user-friendly approach. But that's still future thoughts, no concrete plans yet :) |
I could really use 3.10 here as well. |
Hi everyone, I'm Tommy from OBS Projects, and I'm currently working on bring OBS Studio to Windows ARM64. I still prefer the regular executable installer on ARM64, because it's probably the least intrusive way of making Python scripting work with OBS Studio. Please provide the regular executable installer for ARM64. I'm also interested in ARM64EC. I haven't tried it yet, but what's your confidence that it will compile on ARM64EC toolchain? |
Hi Tommy! Glad to have you join the discussion (I'm a huge fan of OBS Studio, and if the license wasn't incompatible with my employer, I'd be actively contributing :) ) Our challenge with the installer is the portability of Wix Toolset. I'm pretty sure our current version doesn't support ARM64, and they haven't released a newer version that does yet. It's possible that emulation will handle the main part of our installer, but AFAIK nobody has tested it to see whether it confuses the underlying installer service. (I can probably do that at some point, as I have access to some test machines now.) At the same time, any reason why OBS doesn't just include a copy of Python with it? It should be quite easy to include the embeddable runtime on Windows, which would then mean that you're able to ship the exact version necessary and have the paths preconfigured. (It *might* complicate installing 3rd party packages a bit, but you can always allow search paths to be set/PYTHONPATH to be respected, or the executable path overridden.) Possibly this is something you guys have already looked into, so if you know there's an issue I'd love to hear about it. Making it easy/easier to bundle Python with apps like OBS is one of my major focuses. |
Hi Steve, We appreciate your interest in OBS Studio! In my opinion, the installer doesn't have or need to be in ARM64, because it's not more complex than copying files and writing registry keys, and as an installer, it should be the most forgotten part of python that usually runs for once or twice. For the reason why OBS doesn't include a copy of python, OBS Studio on Windows is already huge (~130MB installer, ~500MB after install), and we don't want to add another disk space eater on already huge installer. We are working on a way to find Python installed on the system, but it seems pretty complicated. |
PEP-514 is the way to find it on Windows (you should be able to look directly for your supported version, rather than enumerating to search). As far as I know, the best way to find it on macOS and Linux is to search PATH for "python3.X". Appreciate the size concerns. The Python runtime comes down to about 10MB with some basic tricks (already done on Windows in the embeddable distro), such as excluding the docs, test suite and zipping the standard library. It's possible with different tricks to do the same on other platforms, so you may even find the best balance for yourselves and your users is to repackage those and do a download-on-demand, rather than looking for a system installed Python.
Oh I wish this were the case! Installers should be forgotten, but they need to be 100% reliable or people *really* notice :) But updating the installer build to target ARM64 while generating an x86 executable should be possible, it just hasn't been done yet. |
Turns out they've released some test versions that support it (partially, but enough), just nothing that they've declared stable. I'll push updated tools for 3.11 so we have a chance to discover any breakage in earlier versions, but should be able to do ARM64 regular installer next alpha (Pablo, FYI - this will require updates to your side of things). |
No problem! What do I need to update? The script to add the binaries to the release page? |
Yeah, will just be the same files again but with "arm64" in place of "win32"/"amd64". I'm also going to stop uploading the old webinstall files with my change here, though that shouldn't matter. The code we added to filter them out should handle them being completely absent, IIRC. |
The ARM64 installer will be part of the next 3.11 release, minus the py.exe launcher (which needs a chunk of work in bpo-46566) and Tcl/Tk (which needs upstream support for the platform) and hence IDLE. I'm hesitant to make a final release without these components. At the same time, I'm concerned about other release blocking issues that may arise that are unrelated, so I do want to get releases out even without them so that we have a chance to discover them. |
Tcl/Tk tracking issue is bpo-46567 |
Closing this issue, as we have others to track individual tasks. |
Thank you Steve! |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: