GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BLD: switch to meson-python as the default build backend by rgommers · Pull Request #23838 · numpy/numpy

Conversation

@rgommers

@rgommers rgommers commented May 29, 2023

Copy link
Copy Markdown
Member

Time to give this a go now we're developing for 2.0 on main. Will also make it easier to use NumPy main with Python 3.12 dev builds.

Follows up on #23808 (comment).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

seberg, lorentzenchr, EwoutH, and bersbersbers reacted with thumbs up emoji
All reactions
  • 👍 4 reactions
@rgommers rgommers added component: build 36 - Build Build related PR Meson Items related to the introduction of Meson as the new build system for NumPy labels May 29, 2023
@rgommers
rgommers force-pushed the default-to-meson branch from bd85443 to 055345b Compare May 29, 2023 16:13
@charris

charris commented May 29, 2023

Copy link
Copy Markdown
Member

I think recent versions of rtools are preinstalled in GitHub actions. I suspect it is possible to split windows builds into separate cases for 32 and 64 bits and use the appropriate version of rtools. Of course, we could also just drop 32 bit builds for 2.0.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented May 29, 2023

Copy link
Copy Markdown
Member Author

Of course, we could also just drop 32 bit builds for 2.0.

This one:) xref gh-23717.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers rgommers mentioned this pull request Jun 5, 2023
pyproject.toml: Upgrade setuptools for Python 3.12 beta 1 #23824
Closed
@charris charris mentioned this pull request Jun 6, 2023
MAINT: pyproject.toml: Update required build dependencies #23891
Closed
@rgommers rgommers mentioned this pull request Jun 8, 2023
NumPy does not install on Python 3.12.0b1 #23808
Closed
@mattip

mattip commented Jun 8, 2023

Copy link
Copy Markdown
Member

Another option is to use MSVC on windows. We need 2 things from rtools: mingw (for gcc) and gfortran. We used to require mingw in order to mangle the openblas.a file to create an import library, but no longer need to do that, so mingw is no longer required. gfortran is needed for fortran, but that is only needed in the f2py tests. We could skip them on win32 (if gforfrtran is not found).

rgommers reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jun 8, 2023

Copy link
Copy Markdown
Member Author

A few different failures left:

..\..\meson.build:30:4: ERROR: Problem encountered: NumPy requires GCC >= 8.4

Should not be too difficult to resolve, we need the right version from Rtools. @mattip will try to fix that up next week once he has access to his Windows machine.

FAILED ..\build-install\Lib\site-packages\numpy\tests\test_public_api.py::test_array_api_entry_point

The .dist-info directory of the wheel does seem to contain the right entry_points.txt entry, but the entry point doesn't get installed for some reason. I'll look into this.

numpy/core/_multiarray_umath.cpython-310-aarch64-linux-gnu.so: undefined symbol: cblas_cdotc_sub

This is due to the wheel being built against ILP64 OpenBLAS, and the symbol suffix handling for that needs wiring up.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jameslamb jameslamb mentioned this pull request Jun 9, 2023
[python-package] [ci] switch to PEP 517 / 518 builds (remove setup.py) (fixes #5061) lightgbm-org/LightGBM#5759
Merged
@mattip

mattip commented Jun 11, 2023

Copy link
Copy Markdown
Member

meson-python can handle setting up windows to use MSVC via a setup setting that will be ignored on non-windows.

[tool.meson-python.args]
setup = ['--vsenv']

I think that is also the path to adding 64-bit interfaces via a compile = ['-DBLAS_SYMBOL_SUFFIX=64_'] setting.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jun 11, 2023

Copy link
Copy Markdown
Member

I will rebase this off main to clear the conflict and push a commit to add the tool.meson-python.args settings.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jun 11, 2023

Copy link
Copy Markdown
Member

hmm, maybe the compile = ['-DBLAS_SYMBOL_SUFFIX=64_'] option is too much: it will also use 64-bit interfaces on 32-bit builds.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
mattip force-pushed the default-to-meson branch 3 times, most recently from 16b0895 to 067e514 Compare June 11, 2023 14:32
@mattip

mattip commented Jun 11, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Getting somewhere.

The manylinux wheel builds are failing with

FAILED core/tests/test_umath.py::TestComplexFunctions::test_loss_of_precision[complex64]
FAILED core/tests/test_umath.py::TestComplexFunctions::test_loss_of_precision[complex128]
FAILED core/tests/test_umath.py::TestComplexFunctions::test_loss_of_precision[clongdouble]

The musllinux wheel builds have lots of DeprecationWarnings in tests, and fails python /project/tools/wheels/check_license.py

MacOS wheels are failing some einsum tests

FAILED core/tests/test_einsum.py::TestEinsum::test_einsum_sums_int8 - Asserti...
FAILED core/tests/test_einsum.py::TestEinsum::test_einsum_sums_uint8 - Assert...

Windows wheels is failing to find OpenBLAS, the PKG_CONFIG_PATH is probably not propagating properly.

PyPy does not build, it seems the include paths are not right?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
mattip force-pushed the default-to-meson branch from 2eda803 to ffcd334 Compare June 11, 2023 20:20
rgommers
rgommers commented Jun 12, 2023
View reviewed changes
Comment thread pyproject.toml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jun 12, 2023

Copy link
Copy Markdown
Member Author

meson-python can handle setting up windows to use MSVC via a setup setting that will be ignored on non-windows.

This seems a bit too agressive, it's better to make it specific to cibuildwheel to avoid forcing MSVC usage on everyone who builds from source. Probably this is the way:

[tool.cibuildwheel.windows]
config-settings = {"setup-args=--vsenv"}

or alternatively as an env var:

CIBW_CONFIG_SETTINGS_WINDOWS: "setup-args=--vsenv"
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jun 12, 2023

Copy link
Copy Markdown
Member Author

PyPy does not build, it seems the include paths are not right?

I thought that was fixed for SciPy so it should work - good idea to disable that build config like you did and do that separately though.

MacOS wheels are failing some einsum tests

That looks odd. Also there's a test_new_policy failure in the macOS jobs.

It'd be useful to make the cibuildwheel jobs non-verbose, the CI logs are hard to navigate now - the log is 23,900 lines long. It's the verbose=2 usage in tools/wheels/cibw_test_command.sh`. Do you see a reason to keep them verbose?

The musllinux wheel builds have lots of DeprecationWarnings in tests, and fails python /project/tools/wheels/check_license.py

I am unsure why other jobs are not failing on that, but the LICENSE.txt file is not installed into site-packages/numpy on purpose. It belongs in .dist-info not inside the source tree.

   + python /project/tools/wheels/check_license.py
  Traceback (most recent call last):
    File "/project/tools/wheels/check_license.py", line 54, in <module>
      main()
    File "/project/tools/wheels/check_license.py", line 38, in main
      with open(license_txt, encoding="utf-8") as f:
  FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp.MGkClm/venv/lib/python3.10/site-packages/numpy/LICENSE.txt

So it's the test that needs tweaking here.

The manylinux wheel builds are failing with

FAILED core/tests/test_umath.py::TestComplexFunctions::test_loss_of_precision[complex64]

Those seem to be gone, at least I checked two jobs and it only shows the same test_new_policy failure as on macOS.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jun 12, 2023

Copy link
Copy Markdown
Member

It's the verbose=2 usage in tools/wheels/cibw_test_command.sh`.

I will reduce it

make it specific to cibuildwheel to avoid forcing MSVC usage on everyone

I will move the directive

So it's the test that needs tweaking here.

I will try to fix that

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jun 12, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

The wheels are building with meson setup ... -Dbuildtype=release -Db_ndebug=if-release which sets the compiler optimization to -O3. I think this is the source of some of the test failures. The -Ddbuildtype=release is a meson-python default, where the non-wheel builds are using meson without meson-python. I think this should be a general default overrid for meson-python, we don't want users getting failed tests out of the box. At some point we should fix the failures.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jun 12, 2023

Copy link
Copy Markdown
Member Author

@mattip do we want to default to -O2, like distutils does? Seems fine to me, I don't have a strong preference here. We actually have different defaults hardcoded per compiler in numpy.distutils, e.g. the Intel compilers are using -O1. Overall that's a bit of a mess, so I think having a single uniform default and then treating the rest as either numpy bugs or compiler bugs seems cleaner.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@refparo refparo mentioned this pull request Jun 12, 2023
BLD: undefined symbol: cblas_sgemm when building with meson with pip install #23909
Closed
@mattip

mattip commented Jun 12, 2023

Copy link
Copy Markdown
Member

Using

[tool.meson-python.args]
setup = ['-Dbuildtype=custom','-Doptimization=0', '-Db_ndebug=true']

gives me

   User defined options
      Native files: /project/.mesonpy-fjiq3ch_/build/meson-python-native-file.ini
      buildtype   : custom
      optimization: 0
      b_ndebug    : true
      b_vscrt     : md

but the three tests still fail. I will commit what I have so far so others can try. I am not sure what is the delta to the other meson builds or to th distutil builds.

There are also DeprecationWarnings Conversion of an array with ndim > 0 to a scalar is deprecated in tests.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jun 12, 2023

Copy link
Copy Markdown
Member

There is still a problem with the license file. I think the syntax here

# Using https://peps.python.org/pep-0639/ which is still in draft
license = {text = "BSD-3-Clause"}
license-files.paths = [
    "LICENSE.txt",
    "LICENSES_bundles.txt"
]

is different from the syntax in the meson-python test

[project]
name = 'license-file'
version = '1.0.0'
license = { file = 'something/LICENSE.custom' }
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jun 12, 2023

Copy link
Copy Markdown
Member Author

There is still a problem with the license file. I think the syntax here

Ah right, yes I had counted on PEP 639 moving forward by now. Let me have a look at this one right now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers
rgommers force-pushed the default-to-meson branch from f52cb49 to 2670a13 Compare June 18, 2023 14:02
@rgommers

rgommers commented Jun 18, 2023

Copy link
Copy Markdown
Member Author

I think you can add CIBW_ARCHS_WINDOWS=auto64 around here in the wheel.yml file

Ah thanks, that explains it! The skip's in pyproject.toml seem entirely unused then, the jobs are indeed controlled in wheels.yml.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers
REL: don't build 32-bit Python wheels with cibuildwheel
a5ef06b
@rgommers
rgommers force-pushed the default-to-meson branch from 2670a13 to df40e19 Compare June 18, 2023 14:07
@rgommers

rgommers commented Jun 18, 2023

Copy link
Copy Markdown
Member Author

The 32-bit long double detection hack isn't quite working: undefined symbol: Dragon4_PrintFloat_Intel_extended128. May have to punt on that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers
rgommers force-pushed the default-to-meson branch from df40e19 to 6f7d768 Compare June 18, 2023 14:29
@rgommers

rgommers commented Jun 18, 2023

Copy link
Copy Markdown
Member Author

The macOS arm64 on Cirrus CI are still failing with:

_multiarray_umath.cpython-39-darwin.so, 0x0002): symbol not found in flat namespace (_cblas_caxpy)

That's related to forcing NPY_USE_BLAS_ILP64="1" but not using -DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64 in CFLAGS unlike on GHA for x86-64.

Other than that, this is getting close. Trying to get it green by tonight.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rgommers added 8 commits June 18, 2023 18:41
@rgommers
TST: disable longdouble string/print tests on Linux aarch64
7948464
See numpygh-23974
@rgommers
BLD: hack around broken long double size detection on 32-bit Linux
c808cfd
@rgommers
TST: fix deprecation warnings from f2py test for ndim>0
9d588cf
Representative subset of warnings observed in CI:
```
f2py/tests/test_return_integer.py: 20 warnings
  /tmp/tmp.roLIRtEhPN/venv/lib/python3.9/site-packages/numpy/f2py/tests/test_return_integer.py:24: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    assert t(array([123], "d")) == 123

f2py/tests/test_return_real.py: 20 warnings
  /tmp/tmp.roLIRtEhPN/venv/lib/python3.9/site-packages/numpy/f2py/tests/test_return_real.py:23: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    assert abs(t(array([234])) - 234.0) <= err

f2py/tests/test_return_real.py: 20 warnings
  /tmp/tmp.roLIRtEhPN/venv/lib/python3.9/site-packages/numpy/f2py/tests/test_return_real.py:24: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
    assert abs(t(array([[234]])) - 234.0) <= err
```
@rgommers
TST: xfail einsum int8/uint8 test temporarily
c41a1e2
@rgommers
TST: disable test_new_policy test for memory allocator.
515403f
This is way too slow, running a large part of the test suite twice.
Issue 23975 tracks changing how this feature is tested.
@rgommers
CI: avoid use of pytest for 32-bit Linux Azure job; remove xml coverage
910c686
@rgommers
CI: fix ILP64 usage on macOS arm64 with cibuildwheel
69f26cf
Also remove a no longer needed `-std=c99` (this is already specified
in the top-level `meson.build` file).
@rgommers
CI: disable pypy3.9 job on Azure temporarily
302f244
@rgommers
rgommers force-pushed the default-to-meson branch from 6f7d768 to 302f244 Compare June 18, 2023 16:47
@rgommers
BLD: on 32-bit Linux, if sizeof(long double) is 12, change format
11a3cef
[skip circle] [skip cirrus]
@rgommers rgommers mentioned this pull request Jun 18, 2023
Tracking issue: defaulting to Meson - follow-up tasks #23981
Closed
18 of 20 tasks
@rgommers

rgommers commented Jun 18, 2023

Copy link
Copy Markdown
Member Author

Okay, this is ready to go in, phew:) All the follow-ups to this PR are listed in gh-23981.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mattip
mattip approved these changes Jun 18, 2023
View reviewed changes

@mattip mattip left a comment

Copy link
Copy Markdown
Member

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.

LGTM, except for a few nits and checks for things that might need to be in the tracking issue

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread .github/workflows/build_test.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread azure-pipelines.yml
python3 -m pip install threadpoolctl && \
python3 tools/openblas_support.py --check_version"
cd tools && \
python3 -m pytest --pyargs numpy"

@mattip mattip Jun 18, 2023

Copy link
Copy Markdown
Member

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.

This has removed the check for the openblas version. Is that on purpose?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rgommers rgommers Jun 18, 2023

Copy link
Copy Markdown
Member Author

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.

Yes, we now have proper logging in the build log for the version, and this cannot really be wrong (no other OpenBLAS version is installed in CI). This job was painful to debug, so I trimmed it down as much as possible.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread numpy/random/tests/test_extending.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@rgommers rgommers added this to the 2.0.0 release milestone Jun 18, 2023
@rgommers
Merge remote-tracking branch 'upstream/main' into default-to-meson
e3ddda5
@rgommers

rgommers commented Jun 19, 2023

Copy link
Copy Markdown
Member Author

This is still green after merging in the long double format detection fix from main. The commit history is clean enough I'd say and useful, so I'll prefer to merge it as is.

I'll go ahead and merge this to keep the ball rolling. Thanks for the reviews and help @mattip!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers
rgommers merged commit 00f8acb into numpy:main Jun 19, 2023
@ianthomas23 ianthomas23 mentioned this pull request Jun 23, 2023
Why break 32-bit users in version 1.1? contourpy/contourpy#255
Closed
seberg
seberg reviewed Jun 27, 2023
View reviewed changes
Comment thread meson.build Resolved

Uh oh!

There was an error while loading. Please reload this page.

@charris charris mentioned this pull request Aug 2, 2023
MAINT: Massive update of files from main for numpy 1.26 #24308
Merged
@mattip mattip mentioned this pull request Sep 21, 2023
BLD: add libquadmath to licences and other tweaks #24753
Merged
@HaoZeke HaoZeke mentioned this pull request Nov 13, 2023
DOC: f2py CLI documentation enhancements #25124
Merged
@rgommers
rgommers deleted the default-to-meson branch December 10, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@seberg seberg seberg left review comments
@mattip mattip mattip approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

36 - Build Build related PR component: build Meson Items related to the introduction of Meson as the new build system for NumPy

Projects

None yet

Milestone

2.0.0 release

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@rgommers @charris @mattip @seberg
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.