Skip to content
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

Set SYSTEM_VERSION_COMPAT=0 during pip install on macos #1768

Merged
merged 8 commits into from
Mar 11, 2024
24 changes: 22 additions & 2 deletions cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,17 +579,37 @@ def build(options: Options, tmp_path: Path) -> None:
shell_with_arch(before_test_prepared, env=virtualenv_env)

# install the wheel
if is_cp38 and python_arch == "x86_64":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this change only fixed the MacOS builds for the cp38 case. My builds for cp36 and cp37, e.g.: https://github.com/alexlancaster/pypop/actions/runs/9866159045/job/27244457994#step:4:298 fail.

I had to modify my pyproject.toml to include the SYSTEM_VERSION_COMPAT=0 as a workround, but I feel this should be in cibuildwheel, and the comment here: #1768 (comment) seems to imply that the fix should also apply to <cp38 builds too, but it doesn't appear to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users of Python 3.6 and 3.7 can't install wheels that target macOS newer than 11.0. So you can build them, but users can't install them - well, they technically could, but they'd have to set SYSTEM_VERSION_COMPAT=0 too when they install them, otherwise pip will see the wheels as targeting a macOS that's newer than what's running.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, but isn't it possible that Python 3.6 or 3.7 could be running on MacOS 12 or later? or did Python drop packages for those Python versions after 11.0?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See this comment for further explanation- #1768 (comment)

virtualenv_env_install_wheel = virtualenv_env.copy()
virtualenv_env_install_wheel["SYSTEM_VERSION_COMPAT"] = "0"
log.notice(
unwrap(
"""
Setting SYSTEM_VERSION_COMPAT=0 to ensure CPython 3.8 can get
correct macOS version and allow installation of wheels with
MACOSX_DEPLOYMENT_TARGET >= 11.0.
See https://github.com/pypa/cibuildwheel/issues/1767 for the
details.
"""
)
)
else:
virtualenv_env_install_wheel = virtualenv_env

call_with_arch(
"pip",
"install",
f"{repaired_wheel}{build_options.test_extras}",
env=virtualenv_env,
env=virtualenv_env_install_wheel,
)

# test the wheel
if build_options.test_requires:
call_with_arch(
"pip", "install", *build_options.test_requires, env=virtualenv_env
"pip",
"install",
*build_options.test_requires,
env=virtualenv_env_install_wheel,
)

# run the tests from a temp dir, with an absolute path in the command
Expand Down
Loading