-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Build wheels with oldest supported numpy #3467
Conversation
I'm pretty sure we were using A fix will be most welcome! |
c8ad54f
to
a9d828e
Compare
8243bd4
to
7d1adff
Compare
@@ -40,12 +40,12 @@ jobs: | |||
env: | |||
CIBW_ARCHS_LINUX: x86_64 aarch64 | |||
CIBW_ARCHS_MACOS: x86_64 arm64 | |||
CIBW_ARCHS_WINDOWS: AMD64 x86 ARM64 | |||
CIBW_BEFORE_BUILD: pip install numpy scipy | |||
CIBW_ARCHS_WINDOWS: AMD64 x86 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piskvorky Sorry for some regression here. I would wait with ARM64 wheels since there are not many such systems, and also, Numpy, Scipy and other main libraries do not provide Windows arm64 wheels.
oldest-supported-numpy
does not support that either. I would wait for them to start supporting arm64; otherwise, we must write a few ugly conditions for Numpy ourselves.
7d1adff
to
5fd0b6c
Compare
CIBW_SKIP: pp* cp36-* cp37-* *-win32 *_i686 *-musllinux_* | ||
CIBW_TEST_COMMAND: pytest -rfxEXs --durations=20 --disable-warnings --showlocals --pyargs gensim | ||
CIBW_TEST_REQUIRES: pytest testfixtures mock | ||
CIBW_TEST_SKIP: cp38* cp39* cp310* *_aarch64 *_arm64 *_universal2 | ||
CIBW_BUILD_VERBOSITY: 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It provides some more verbosity (e.g. to see the NumPy package version towards the package was built).
It is ready to merge if you agree with the changes. After the merge, I would ask for a minor release to fix packages on PyPI. |
To me it seems the title doesn't match the changes in the PR. The title is "Use oldest-supported-numpy for build".
|
@mpenkov I changed the tile and the description above. The main purpose of the PR is to fix wheel building to use the oldest supported numpy for building. Currently, it uses the newest and it causes issues like this #3097. Maybe the title was not the most accurate but was not far. Those three lines that you mention are more like side effects. Please take a look in the description on the top I added more information there. |
@mpenkov looks like the latest Gensim release is broken for many users (and the displayed build badge on github is red = failed too). WDYT – a quick call? |
Sure, let's have a chat during the usual evening JST timeslot. |
@PrimozGodec Not sure what's going on here. These three items are the only thing I'm seeing in this PR. I don't see any other changes. Is github playing tricks on me, or did you perhaps forget to push something? |
@mpenkov No, everything is in here. So the important change is adding So if you take a look at logs in wheel building GH action prior to this PR, you would notice that Numpy 1.24.3 is used, which is the newest, and it is causing problems (like those here #3097) for users with the older versions of Nympy in their environments. And if you take a look at the logs of the wheel build GH actions in this PR, you will see that older (oldest supported by Numpy at each system/python version) versions of Numpy are used for wheel build, which solves problems for users with older Numpys in their environments. You already had something like this implemented manually before and was regressed in #3448. |
It looks like the new Any way to avoid this duplication? This is a recipe for trouble when the two files get out of sync. @PrimozGodec do we need both? Unless |
@piskvorky I kind of missed that you have setup_requires in I agree it is not good to have those requirements in two places, so we will need to decide where to store them. Please let me know what you prefer. I can implement both, except that having them in setup.py will require installing Numpy beforehand, as it was now in the build-wheel.yaml file (line 44, which I removed) since it is imported in setup.py. It also has some kind of duplication. Having pyproject.toml avoids it. |
I have no preference between In fact, I'm slightly in favour of the "official recommended method" (toml), because it should be easier to maintain going forward. My only worry is that a major refactoring will miss some subtle edge case (our |
5fd0b6c
to
4a05b6b
Compare
Now I moved all build requirements from setup.py to pyproject.toml. You can check what the changes are. I see two problems here:
The positive thing about having requirements in pyproject.toml is that you simplify or remove If you think the proposed changes are too much, I would rather not use pyproject.toml then. |
Thanks for investigating. IIRC requiring Cython was a pain because of Windows. The build system there is weird and difficult. Unless something changed in the Python ecosystem since I last looked, requiring Cython (which we don't need at all) is a no-go. What do you mean "for building" – just internal CI builds, or when users build/install Gensim from source with pip? |
I do not propose removing the Cython; just considering the option of not having it fixed to a specific version. Is the version fixed because of problems you had with Windows? If we want to keep the fixed Cython version and the option to set it via environment variable, I suggest keeping everything in
For both pip and CI. Actually, |
I checked You can read about his motivation there; I don't personally use this override so it's best to talk directly to Paul if needed. @pabs3 what's your experience with Debian vs
You propose adding it, not removing it. If we don't need Cython at all why should we force users to install it? Looks like a regression to me: Gensim required Cython for a while, but then we managed to get rid of the dependency (IIRC – @mpenkov please correct me if I'm wrong). |
The Cython override was because Debian almost always has a different
version than the one hard-coded in setup.py, before I was patching the
version but that meant updating the patch often, so the override
variable was added as a way to avoid the patch updates.
pyproject.toml is the future of Python packaging, so switching away
from setup.py to it would be a good idea. I would recommend not pinning
versions (use ranges instead) in it, so that people can choose which
versions they build with, automatically getting security updates etc
when needed. If you decide to stick to pinning versions, then I will
need to go back to patching the Cython version requirement, but that
isn't a big problem. I'll try to find out override mechanisms.
Debian tries to always build everything from source and never use any
prebuilt files, so the build-time dependency on Cython is definitely
needed for us. Presumably it isn't needed at runtime though.
…--
bye,
pabs
https://bonedaddy.net/pabs3/
|
4a05b6b
to
1477d27
Compare
@mpenkov, it is a good idea to add tests for wheels. Anyway, I just checked the failing test, and I am curious to know how it is possible that it failed. On Windows/Python 3.10 oldest-supported-numpy use Numpy 1.21.6. Which is installed here; also, when I checked the building GH Actions same version was used for building (1.21.6) of Windows python3.10 wheel. The error |
Yeah, I was wondering about the same thing. Still haven't come up with an explanation. Let me know if you think of something. |
@nikaro Are you able to look at this? It looks like this problem got introduced alongside cibuildwheel in #3448. I'm still struggling to understand how this could be happening. For Python 3.10 on Windows:
I'm starting to suspect the problem may be outside of gensim, either in oldest-supported-numpy or even numpy itself. |
@piskvorky I don't see us making any quick progress on this last remaining wheel (Python 3.10 on Windows). I think we should discuss contingencies:
The main problem is that the broken wheel is for a platform that none of the developers involved appear to use (I personally apply effort to avoid Windows whenever possible). |
I'd go with "Release without win-py3.10 wheel". Or perhaps "Release without that wheel and add a note in the release notes". It is a curious mystery for sure. |
Merged. Thank you @PrimozGodec ! |
@mpenkov and @piskvorky, can I request a new release at PyPI? Wheels in the current release are still broken (they do not work with older versions of Numpy). |
@mpenkov a new release sounds reasonable… let me know when you have a ~1h window. We can release over a call, also catch up. |
@piskvorky thank you for a fast response. :) |
@piskvorky Sorry for asking again, but are there any plans for release? Is anything preventing the new release (do you need any help)? |
@PrimozGodec yes, we're on it. We went over the necessary steps with @mpenkov , I believe the release is imminent. |
@PrimozGodec Previously, the tests for the Windows Py3.10 wheels were failing. Now, the Ubuntu wheels are also failing to build. If you can have a look, that would be helpful. https://github.com/RaRe-Technologies/gensim/actions/runs/5803283551 |
Hmm, it looks strange. There are two builds
I also tried to run the test locally and cannot reproduce it. |
@mpenkov It looks that those tests are failing a bit randomly (sometimes fail, sometimes not). It looks like a problem on Ubuntu. Do you have any Linux machines to test it out (I don't have one)? Another thing that I noticed is that tests (regular CI tests) run much slower now. Before, they ran less than 10 minutes on Ubuntu, and now it takes more than 30min (they stop at 30% after 30 minutes). |
This is concerning. It sounds like a regression. |
I cannot reproduce the slowdown locally, when building from source. The tests all pass within 5-6 minutes. However, if I download one of the built wheels (x86_64 linux), install it, and run the tests, then I do get a significant slowdown running the tests. So:
If anyone is able to help with 2), you are most welcome! |
It seems that after #3448, Gensim's wheels are built on the newest Numpy, causing problems with backward compatibility. In my case, for example, Gensim 4.3.1 doesn't work with Numpy 1.21.6. I think it would also fix issues reported here #3097
Use the
odest-supported-numpy
meta-package, which will cause the wheels will be built with the oldest Numpy supported for every Python/system combination.Side effects and other changes: