-
Notifications
You must be signed in to change notification settings - Fork 21
Please revert to VS2017-compatible build for Numpy #145
Comments
I'm willing to make that change, but eventually there should be a move to more recent versions. Given the downstream impact, we should plan for that move in advance and come up with a way to coordinate. I'm curious which static libraries are the problem here, it seems that NumPy 1.22 is not self contained, or at least requires libraries that some environments do not have. |
I think this is due to using the "windows-latest" Azure image. The place to inject the call I thing is just before building the wheel somewhere around here
We ship the |
@mattip Will a program compiled against an older NumPy still run on a newer NumPy compiled with a different version? That would break forward compatibility if we ever change the version. |
According to https://docs.microsoft.com/en-us/cpp/porting/binary-compat-2015-2017?view=msvc-170 it is the linker that needs to be updated. I don't see how that helps here, as most folks will compile and link with the same toolset. |
Yes. |
@charris - for the linker - my reading is that if you are linking with 142 libraries, you need the 142 linker. So that means that anyone who is linking against Numpy - |
On the cibuildwheel-based github action in numpy/numpy we are using windows-2019 so this same issue will come up again in a few months. I see conda-forge uses the Scipy is using windows-latest on azure for CI testing, and "Visual Studio 2017" on appveyor for building wheels. Perhaps scipy would also consider updating scipy wheel building (perhaps by copying the azure pipeline workflow from CI and dropping appveyor). Unifying the CI workflow and the wheel-building workflow might prevent some subtle bugs in wheels, like this one. |
Yes - the recipe that @isuruf gave above is for activating the v141 builds on the windows-2019 image. Windows, like Mac, can build for compatibility with earlier toolchains, from up-to-date installs of Visual Studio. So, I don't think there's an immediate threat of being unable to use v141 on modern images. I'm sure Scipy will update its workflow - but the particular problem here is that we (Scipy) are using Mingw-w64 - and that also runs into trouble linking v142 flavor libraries. |
Maybe - this has to be tested - using the flag Using mingw-w64 for scipy build means that binutils Another approach in the long run (see matthew-brett/dll_investigation#1 (comment)) is to expose |
Small tweak on that - they should probably be packaged into the This does seem like a good way to go though to me, since shared libraries are more portable than static ones and should prevent trouble like what we're seeing now when trying to build with Mingw. One thing I don't know is what the reasons were to provide |
Can I propose a new issue to discuss |
I don't recall. The original decision was npymath and that was over ten years ago when Windows wasn't much used. Later libraries probably followed existing practice. Npysort was for convenience, I don't think it was made public, although that was a possibility.
I think the appveyor build uses 1.40 with VS2017. |
To unpack my reasoning on going back to v141 now, even if, in due course, we refactor |
@isuruf - can you say something about the discussions about this on Conda-forge? |
At conda-forge we are moving to |
So it seems we should do the same here, and in the cibuildwheel numpy/numpy github action |
That seems the best short term solution. I wonder what the downstream problems of changing to DLL's would be if we choose that route in the long term. |
Of course one could think about deploying static as well as shared libraries then. |
Issue to discuss future of Npymath : numpy/numpy#20880 |
@matthew-brett Go ahead and make that PR. |
See discussion at MacPython#145
A comment on this: |
Dec 19 2021 in the maintenance branch. The commit was mislabeled here, cut-and-paste error. |
Ah thanks, makes sense. |
Yes, and then vs2019 was made to use 14.1 in the commit after that. This is all getting a bit hazy ... |
I know, we probably just ran into it when moving SciPy to |
See my comments here: numpy/numpy#20880 (comment) |
Summary
The 1.22 series are using the latest VS2019 toolchain (version 142). This makes the built objects and static libraries incompatible with software built with older toolchains. Would you accept a PR to use the older VS2017 version 141 toolchain instead?
Detail
The Numpy 1.22 series wheels are breaking the Scipy MinGW-w64 builds.
I believe this is because y'all have updated from the previous VS2017 toolchain (version 141) to the latest VS2019 toolchain (version 142).
As MS point out, using version 142 to build the static libraries means that anyone linking against those libraries must also be using (at least) this toolchain.
This means that projects like Scipy can't link to Numpy without also updating to version 142.
In fact, for Scipy, it also, and presumably for similar reasons, breaks our ability to link using MinGW-w64:
matthew-brett/dll_investigation#1
I believe, for these reasons, conda-forge has standardized to version 141 for their builds.
Would y'all consider following conda-forge, and using the 141 toolchain for builds, so that more of us can safely
link to Numpy - particularly - npymath?
@isuruf tells me that this just requires the following lines for a Visual Studio 2019 image:
@isuruf points out that
@rgommers @carlkl
The text was updated successfully, but these errors were encountered: