Pin numpy version at build to handle Numpy's API change in v1.20 #474
+2
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request
The C-API change in Numpy v1.20 has the potential to cause incompatibility issues, as seen in #469 (comment).
This happens when a user hasn't upgraded yet to Numpy 1.20 (or can't upgrade, e.g. because of apt-get availability or pinned due to Tensorflow requirements). Because the build requirement in
pyproject.toml
is an unversioned numpy, it will pull in the latest >=1.20 version and build madmom against it, which gives problems when running with the <1.20 version because the latter is not forward compatible.Numpy's C-API is forward compatible though, so the solution is to pin the build version at a low enough version, it doesn't matter if this version is lower than the version used at runtime. You could do this per Python version, as is currently done in
pyproject.toml
, but there even is a meta-package for this since it's a common problem. Using the meta-package also makes the solution robust against future Python versions, so that's what I did for this PR.I also snuck in an unrelated warning fix that will become an error in Python 3.10 (due in October).