Hi all,
I meant to write this message a while ago already; now got triggered by a question in response to the SciPy 1.8.1 release announcement and some discussion that followed that on the SciPy issue tracker.
There’s a question about whether we should still support 32-bit Python wheels for Windows. Or more importantly: we already don’t anymore for SciPy at least on Python 3.10, so the question is more: can we keep that status quo, and if that’s okay then will other projects drop 32-bit wheels soon too (saves on packaging & release effort)?
Context:
- When Python 3.10 was released, Azure DevOps - which is where we build wheels for releases and nightlies - did not provide 32-bit Python in its images.
- As a result the first NumPy and SciPy releases that supported Python 3.10 did not have 32-bit Python wheels for 3.10 (building from source was, and still is, possible of course). The same is probably true for other projects.
- There weren’t many (or any?) complaints. However, later Azure did make 32-bit Python available, and therefore @charris updated the NumPy wheels later. 1.21.6 is the lowest version number with wheels; 1.22.x releases have them too.
- Note that there’s actually no way to distinguish between 32-bit and 64-bit Python on 64-bit Windows (see No 1.21.4 wheel available for cp310-win32 · Issue #45 · scipy/oldest-supported-numpy · GitHub for details), which is potentially an issue - users will get builds from source.
- It’s actually a little surprising that we haven’t had more complaints, because building from source on Windows if users do
pip install scipy
will fail for the vast majority of users, unless they are prepared for it and have installed the right compilers and BLAS/LAPACK. The explanation is probably that Python 3.10 adoption is still low, and those adopters are unlikely to run a 32-bit Python; that’s more for the laggards. - So the current status for SciPy is: there are no 32-bit wheels for Python 3.10 in any of the releases that support Python 3.10 (= scipy 1.7.2 - 1.8.1).
- For SciPy 1.9.0 we are switching to Meson as the default build system, with the
numpy.distutils
based build still available as a backup. Currently there is no compiler toolchain which works with the Meson build and allows us to build 32-bit wheels for distribution.- It is possible to build 32-bit wheels from source, given a suitable compiler toolchain. That exists: MSVC + Intel Fortran. We just cannot redistribute those wheels.
- 32-bit Windows wheels are available at Archived: Python Extension Packages for Windows - Christoph Gohlke
- The free Anaconda distribution is also shipped as 32-bit and 64-bit for Windows, and the
defaults
channel supports 32-bit Windows (conda-forge does not). - The compiler toolchain we use is a Mingw-w64 based one, used with some flags to ensure that long double is 64-bits (compatible with MSVC) rather than the Mingw default of 80-bits. See e.g. scipy/windows.yml at 743c283bbe79473a03ca2eddaa537661846d8a19 · scipy/scipy · GitHub for the compiler we’re using in CI.
- Carl Kleffner, who is our expert for this compiler toolchain, opened https://github.com/scipy/scipy/issues/16286 to gauge interest in whether it’s worth to invest effort in updating the Mingw-w64 compiler toolchain to support 32-bit Windows. If you have a use case, please describe it on that issue (in addition to replies you may send here).
- As for why we don’t have a compiler toolchain: basically MSVC + gfortran is what we used via a hacky (if surprisingly robust) solution in
numpy.distutils
. We did not attempt to replicate that hack inside Meson, because (a) it’d be a lot of work, (b) the Meson devs don’t really like hacks, and (c) I don’t like hacks. See https://pav.iki.fi/blog/2017-10-08/pywingfortran.html#building-python-wheels-with-fortran-for-windows for details on what the hack entailed.
- It is also possible that LFortran may mature, and then we have a full Clang-based toolchain which would solve the problem. That will take a while though, and it may not happen at all (it didn’t with Flang, and 32-bit support is probably not a priority for LFortran).
So that’s where we are right now. Usually we use download stats to help inform us with such decisions, so here they are: https://pypistats.org/packages/numpy has downloads per OS, but doesn’t distinguish between 32-bit and 64-bit Python on Windows. Downloads are dominated by Linux (86%) and the total for Windows is 3%, so 32-bit Python on Windows is probably well below 1%. That’s not super informative though.
Longer-term, 32-bit Python is on the way out it looks like - but it could take a long time to disappear. Microsoft was quite slow to provide a 32-bit build of Python 3.10 in Azure DevOps, but it materialized in the end (side note: we could have gotten it through Nuget, I learned later - link). At some point Windows on ARM will probably become a thing that we have to support too (unclear to me when though).
EDIT: Matti started a conversation on the Python packaging Discourse here, and from that it turns out that 32-bit packages are actually useful for Windows on ARM users (that was the main reason people were inquiring about 32-bit binaries).
My personal opinion:
- It’d be quite nice to have a suitable compiler toolchain, because then we wouldn’t have to have this discussion.
- It’s a lot of work to create and maintain though. So if there’s not much demand, that effort could perhaps be spent better on something else. And either way, Carl is the only person around in our community who has both the knowledge and (potentially) interest to work on this. If he would decide not to spend time on this, I’d be completely supportive of that choice.
- I’m personally not really interested to even propose to the Meson devs to replicate the
numpy.distutils
hack. One thing I like about Meson’s philosophy is doing things “the right way” - that’s going to help us in the long run - and glueing together technically incompatible compilers just doesn’t seem like the right thing to do here. Plus this’d be a lot of work too. - It is possible to build SciPy from source, and there are alternative binaries (both wheels and conda packages) as noted above. It doesn’t seem unfair to say that 32-bit Python is niche, and users should go to a third-party vendor for binaries.
- One practical issue with that is that the number of users complaining may increase after the 1.9.0 release, because we won’t have 32-bit Python wheels for Python 3.8 and 3.9 anymore, so
pip install scipy
is going to fail more often. We’ll see soon enough.
- One practical issue with that is that the number of users complaining may increase after the 1.9.0 release, because we won’t have 32-bit Python wheels for Python 3.8 and 3.9 anymore, so
- It would be nice to keep one CI job around that tests 32-bit Python on Windows, even if we don’t release wheels. It’s actually unlikely to break badly if 64-bit Windows and 32-bit Linux jobs pass, and we don’t test many other platforms in CI either, so it’s not a must-have, but still.
Thoughts? Use cases / reasons for not being able to drop 32-bit Python?
Cheers,
Ralf
Philosophical musing: how many person-years would it take to get rid of Fortran in SciPy completely? That would be a better outcome; the most work but it’d get rid of a ton of outdated and badly written code that no one wants to maintain. Many birds with one stone …