-
-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a691ac4
Use oldest-supported-numpy for build
PrimozGodec 0b93283
add workflow step to test wheels against older numpy
mpenkov d058a5f
download installwheel.py
mpenkov 5ed3e74
fix installwheel command
mpenkov d35eb98
patch installwheel.py to take processor into account
mpenkov c708e8f
patch installwheel.py
mpenkov c392326
patch installwheel.py
mpenkov 32ab193
add step to debug test environment
mpenkov 700ee3b
work around numpy bug
mpenkov 8f63e7b
add pip freeze prior to wheel build
mpenkov eef4177
git add .github/workflows/pipfreezedammit.py
mpenkov a6cdaa0
work around cibuildwheel not outputting pip-freeze
mpenkov 69c33bf
update build-wheels.yml
mpenkov 6406cf6
Revert previous commits
mpenkov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
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 commentThe 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). |
||
|
||
- name: Upload wheels as artifacts | ||
if: always() | ||
|
@@ -54,6 +54,55 @@ jobs: | |
name: wheels-${{ matrix.os }} | ||
path: wheelhouse/*.whl | ||
|
||
test: | ||
name: Test wheel for ${{ matrix.os }} Python ${{ matrix.python }} | ||
needs: build_wheels | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-20.04, windows-2019, macos-11] | ||
python: ['3.8', '3.9', '3.10', '3.11'] | ||
|
||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Setup up Python ${{ matrix.python }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Downloads build artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: artifacts/ | ||
|
||
# | ||
# We want to make sure our wheels run against older Numpy versions | ||
# | ||
- name: Install oldest-supported-numpy | ||
run: python -m pip install oldest-supported-numpy | ||
|
||
# | ||
# Avoid checking out the entire gensim repo to get just one file | ||
# | ||
- name: Download installwheel.py | ||
run: curl "https://raw.githubusercontent.com/RaRe-Technologies/gensim/testwheel/.github/workflows/installwheel.py" --output installwheel.py --silent | ||
|
||
- name: Install wheel | ||
run: python installwheel.py artifacts/wheels-${{ matrix.os }} | ||
|
||
- name: Debug test environment | ||
run: | | ||
pip freeze | ||
python -c 'import numpy;print(numpy.__file__)' | ||
python -c 'import numpy;print(numpy.__version__)' | ||
|
||
# | ||
# If the wheel was incorrectly built, then this will fail. | ||
# https://github.com/RaRe-Technologies/gensim/issues/3097 | ||
# | ||
- name: Test wheel | ||
run: python -c 'import gensim' | ||
|
||
upload: | ||
name: Upload to S3 | ||
if: always() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""Install a wheel for the current platform.""" | ||
import os | ||
import platform | ||
import subprocess | ||
import sys | ||
|
||
|
||
def main(): | ||
subdir = sys.argv[1] | ||
vi = sys.version_info | ||
|
||
if platform.system() in ('Linux', 'Darwin'): | ||
arch = 'x86_64' | ||
else: | ||
arch = 'amd64' | ||
|
||
want = f'-cp{vi.major}{vi.minor}-' | ||
suffix = f'_{arch}.whl' | ||
|
||
files = sorted(os.listdir(subdir)) | ||
for f in files: | ||
if want in f and f.endswith(suffix): | ||
command = [sys.executable, '-m', 'pip', 'install', os.path.join(subdir, f)] | ||
subprocess.check_call(command) | ||
return 0 | ||
|
||
print(f'no matches for {want} / {suffix} in {subdir}:') | ||
print('\n'.join(files)) | ||
|
||
return 1 | ||
|
||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[build-system] | ||
requires = [ | ||
"Cython>=0.29.32", | ||
# oldest supported Numpy for this platform is 1.17 but the oldest supported by Gensim | ||
# is 1.18.5, remove the line when they increase oldest supported Numpy for this platform | ||
"numpy==1.18.5; python_version=='3.8' and platform_machine not in 'arm64|aarch64'", | ||
"oldest-supported-numpy; python_version>'3.8' or platform_machine in 'arm64|aarch64'", | ||
"scipy", | ||
"setuptools", | ||
"wheel", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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.