From 2fd83842626b35e3de01bbc52d41400a8c6a8e32 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Fri, 8 Sep 2023 16:46:53 +0200 Subject: [PATCH 1/2] TST: random: skip test for extending with Cython on 32-bit Windows --- numpy/random/tests/test_extending.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/numpy/random/tests/test_extending.py b/numpy/random/tests/test_extending.py index 8c684ca43f40..2783d1cdd9ac 100644 --- a/numpy/random/tests/test_extending.py +++ b/numpy/random/tests/test_extending.py @@ -49,6 +49,10 @@ cython = None +@pytest.mark.skipif( + sys.platform == "win32" and sys.maxsize < 2**32, + reason="Failing in 32-bit Windows wheel build job, skip for now" +) @pytest.mark.skipif(IS_WASM, reason="Can't start subprocess") @pytest.mark.skipif(cython is None, reason="requires cython") @pytest.mark.slow From d4555f14162fc6cdf4b74d11d879a219bed281df Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Fri, 8 Sep 2023 11:41:31 +0200 Subject: [PATCH 2/2] BLD: build wheels for 32-bit Python on Windows, using MSVC [wheel build] This doesn't include OpenBLAS, I haven't tried that - too much effort right now and it doesn't seem critical. Easier to revisit once OpenBLAS is more easily installable as a wheel. xref gh-23717 [skip circle] [skip cirrus] [skip azp] --- .github/workflows/wheels.yml | 7 +++++++ pyproject.toml | 14 ++++++-------- tools/wheels/cibw_test_command.sh | 4 ++++ tools/wheels/repair_windows.sh | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 53ade8a876db..d83bddafdcfc 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -78,6 +78,7 @@ jobs: - [ubuntu-20.04, musllinux_x86_64] - [macos-12, macosx_x86_64] - [windows-2019, win_amd64] + - [windows-2019, win32] python: ["cp39", "cp310", "cp311", "cp312", "pp39"] exclude: # Don't build PyPy 32-bit windows @@ -100,6 +101,12 @@ jobs: # https://github.com/actions/checkout/issues/338 fetch-depth: 0 + - name: Setup MSVC (32-bit) + if: ${{ matrix.buildplat[1] == 'win32' }} + uses: bus1/cabuild/action/msdevshell@e22aba57d6e74891d059d66501b6b5aed8123c4d # v1 + with: + architecture: 'x86' + - name: pkg-config-for-win run: | choco install -y --checksum 6004DF17818F5A6DBF19CB335CC92702 pkgconfiglite diff --git a/pyproject.toml b/pyproject.toml index c9ca8fc7d418..c41fcc1ba92e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -149,7 +149,7 @@ tracker = "https://github.com/numpy/numpy/issues" # Note: the below skip command doesn't do much currently, the platforms to # build wheels for in CI are controlled in `.github/workflows/wheels.yml` and # `tools/ci/cirrus_wheels.yml`. -skip = "cp36-* cp37-* cp-38* pp37-* pp38-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux_aarch64 *-win32" +skip = "cp36-* cp37-* cp-38* pp37-* pp38-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux_aarch64" build-verbosity = "3" before-build = "bash {project}/tools/wheels/cibw_before_build.sh {project}" # meson has a hard dependency on ninja, and we need meson to build @@ -178,17 +178,15 @@ test-skip = "*_universal2:arm64" environment = {CFLAGS="-fno-strict-aliasing -DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", CXXFLAGS="-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", NPY_USE_BLAS_ILP64="1", CC="clang", CXX = "clang++", RUNNER_OS="macOS"} [tool.cibuildwheel.windows] -archs = ['AMD64'] environment = {NPY_USE_BLAS_ILP64="1", CFLAGS="-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", CXXFLAGS="-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64", LDFLAGS="", PKG_CONFIG_PATH="C:/opt/64/lib/pkgconfig"} config-settings = "setup-args=--vsenv" repair-wheel-command = "bash ./tools/wheels/repair_windows.sh {wheel} {dest_dir}" -#[[tool.cibuildwheel.overrides]] -# Note: 32-bit Python wheel builds are skipped right now; probably needs -# --native-file to build due to `arch != pyarch` check in Meson's `python` dependency -# Note: uses 32-bit rather than 64-bit OpenBLAS -#select = "*-win32" -#environment = CFLAGS="-m32", LDFLAGS="-m32", PKG_CONFIG_PATH="/opt/32/lib/pkgconfig"} +[[tool.cibuildwheel.overrides]] +select = "*-win32" +environment = {PKG_CONFIG_PATH="/opt/32/lib/pkgconfig"} +config-settings = "setup-args=--vsenv setup-args=-Dallow-noblas=true" +repair-wheel-command = "" [tool.spin] package = 'numpy' diff --git a/tools/wheels/cibw_test_command.sh b/tools/wheels/cibw_test_command.sh index c35fb56832e5..78966885f180 100644 --- a/tools/wheels/cibw_test_command.sh +++ b/tools/wheels/cibw_test_command.sh @@ -18,6 +18,10 @@ if [[ $RUNNER_OS == "macOS" && $RUNNER_ARCH == "X64" ]]; then # Needed so gfortran (not clang) can find system libraries like libm (-lm) # in f2py tests export LIBRARY_PATH="$LIBRARY_PATH:/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib" +elif [[ $RUNNER_OS == "Windows" && $IS_32_BIT == true ]] ; then + echo "Skip OpenBLAS version check for 32-bit Windows, no OpenBLAS used" + # Avoid this in GHA: "ERROR: Found GNU link.exe instead of MSVC link.exe" + rm /c/Program\ Files/Git/usr/bin/link.EXE else # For some reason the macos-x86_64 runner does not work with threadpoolctl # Skip this check there diff --git a/tools/wheels/repair_windows.sh b/tools/wheels/repair_windows.sh index a7aa209d21d9..0c44d60d6976 100644 --- a/tools/wheels/repair_windows.sh +++ b/tools/wheels/repair_windows.sh @@ -17,7 +17,7 @@ pushd numpy* # building with mingw. # We therefore find each PYD in the directory structure and strip them. -for f in $(find ./scipy* -name '*.pyd'); do strip $f; done +for f in $(find ./numpy* -name '*.pyd'); do strip $f; done # now repack the wheel and overwrite the original