-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
pytest failure when running out-of-tree plugin against 2.25.0a0 - macOS wheels include single architecture native_engine.so
files
#21938
Comments
Weird symptoms! Can you try "bisecting" on the various 2.25 dev releases to see if we can narrow down when it changed? |
@huonw: The change seems to be in play since at least 2.25.0.dev0 with your changes to the release process in #21655. The published artifacts switched over to the current format starting with 2.25.0.dev1 though. 2.25.0.dev0 (universal2 and arm64):
2.25.0.dev1 (universal2 with 10.12):
2.25.0.dev2 (same):
2.25.0.dev3 (same)
2.25.0.dev4 (same):
2.25.0.dev5 (same):
|
Ah, thanks. I guess the problem here is the x86-64 build is installing the apparently-compatible I agree that #21655 seems like a good theory for the PR that caused it to change, although the exact mechanism isn't obvious to me yet. It's also suspicious to me that the arm64 wheel name didn't change in dev0, but did change in dev1. That's seems like a relevant clue 🤔 |
The only commit modifying the release process does not seem relevant? |
External reason: Did the set of runners change in that time frame? Or maybe a runner stalled and another (older macOS) runner ran the release job? |
Also, maybe there were tooling changes on the newer macOS runners, which defaulted to now generating |
dev0 build runner image info: https://github.com/pantsbuild/pants/actions/runs/11941283628/job/33285786191#step:1:9
dev1 build runner image info: https://github.com/pantsbuild/pants/actions/runs/12289144169/job/34294166127#step:1:9
Diffing the list of software shows maybe these are relevant: actions/runner-images@macos-14-arm64/20241022.361...macos-14-arm64/20241202.580#diff-5c04a529d3c8adf7a5f23afe544071dad1853e281c9c7b44cd8d626b6c57444d
There's a chance this might be relevant? But yeah, doesn't seem obviously related. |
My naive thought is that the Xcode version probably matters here, although the diff you pasted is a bit ambiguous. What does |
Or is that an SDK version number and not Xcode version? |
Also, maybe we need to pin the |
Sorry for the ambiguity (it looks like that "perma" link for the diff isn't very useful), it's the macOS version number from this table: https://github.com/actions/runner-images/blob/macos-14-arm64/20241202.580/images/macos/macos-14-arm64-Readme.md#installed-sdks (that's the version for the dev1 runner). |
https://github.com/pypa/cibuildwheel/blob/3805787fe7a0476391541d834fa548a721f0ab2e/cibuildwheel/macos.py#L318-L331 is an interesting read. I wonder if the options set in there are applicable to this situation. |
Collecting more clues: when I run This on an arm64 machine running macOS 15.2, with clang 15.0.0 by default, and an install of Xcode 15.4. (This is an install that appears to be broken, because that's too old, I need to upgrade to Xcode 16.2. I guess I've got a more up-to-date version of the command-line tools installed. I dno, I've forgotten how these details fit together.) |
On my x84-64 Macbook Pro (macOS 15.3 / Xcode 16.2), running |
Interestingly, |
I've started some experiments in #21941 for running things within the real cloud environment. |
Summary:
Investigation:
Thus I think the key change that broke this is 1 vs. 2, changing the type of build of the Python interpreter, and that flowed through into wheel tagging. We can control this via |
Awesome investigation! |
…21942) (#21944) This follows the lead of `cibuildwheel` to explicitly correctly tag our wheels on macOS, via the `_PYTHON_HOST_PLATFORM` environment variable. This change ensures that the `pip` understands which platform each wheel is built for and compatible with, and thus external plugins using `pants_requirements(...)` work again. It appears the file name (including platform) tags of a wheel are derived from `sysconfig.get_platform()`, i.e. based on the build configuration of the current Python interpreter. Pants builds single platform wheels, so the wheels need to be tagged with the right CPU architecture. In #21655, we changed from tagging correctly to tagging incorrectly: - Before that change, our self-hosted runners had 'simple' Python interpreters, built for the current platform via Pyenv. `python -c 'import sysconfig; print(sysconfig.get_platform())' reports `macosx-10.15-x86_64` and `macosx-11.6-arm64`, and indeed the wheels were tagged like that. - After that change, we started using Python interpreters provided by GitHub-hosted runners. The interpreters report `macosx-10.9-universal2` on both the ARM64 and x86-64 runners. That is, they're built as universal binaries that can run on either architecture. This lead to the wheels being tagged as `universal2` as well. The `_PYTHON_HOST_PLATFORM` environment variable overrides the default `sysconfig.get_platform()` value, and appears to be designed for this sort of purpose (and is used by `cibuildwheel` for such): - https://github.com/python/cpython/blob/5505b91a684b0fc7ffcb3a5b325302671d74fb15/Lib/sysconfig.py#L652-L654 - https://github.com/pypa/cibuildwheel/blob/3805787fe7a0476391541d834fa548a721f0ab2e/cibuildwheel/macos.py#L318-L331 Fixes #21938 Co-authored-by: Huon Wilson <[email protected]>
https://github.com/pantsbuild/pants/releases/tag/release_2.26.0.dev1 looks to have correct wheels:
Yay. Thanks for finding the |
Problem: Running pytest under Pants v2.25.0a0 is failing on my macOS/x86-64 system. The project under test is a out-of-tree Pants plugin and the test thus imports from the
pantsbuild.pants
distribution, hence why native_engine.so is being loaded in a test. (See the specific error below.)The
native_engine.so
being imported appears to be for arm64 and not for x86-64:We seem to be publishing universal2 macOS wheels instead of the previous separate architecture-specific wheels.
2.24.1:
2.25.0a0:
Unpacking the wheels, we see that the
.so
files in the root of the wheel are multi-architecture. Yet, thenative_engine.so
in the actual package source directory is one architecture only. (x86-64 for the 10.12 wheel and arm64 for the 11.0 wheel.)The full error that I saw when trying to run my plugin's test was:
The text was updated successfully, but these errors were encountered: