wheel: wheel 0.36.0 fails on macOS 11 (Big Sur) when MACOSX_DEPLOYMENT_TARGET=11

On previously macOS versions, the major version were 10.15, 10.14, etc. But on macOS Big Sur (11.x.y) the major version is now 11, and the next major version will be 12, etc.

Therefore, because MACOSX_DEPLOYMENT_TARGET typically specifies a major macOS version, it is now natural to have MACOSX_DEPLOYMENT_TARGET=11. This is accepted by all system build tools and compilers.

This triggered several build failures in cpython 3.9.0, which are now fixed (see https://github.com/python/cpython/pull/23556). This is also triggering problems now in wheel. We are seeing this error as part of Homebrew build and testing (https://github.com/Homebrew/homebrew-core/pull/66063#issuecomment-737538309).


I install Python 3.9.0, with an upstream patch (https://github.com/python/cpython/pull/23556), and wheel 0.36.0. Then I run pip3 install markupsafe, which gives the following error:

    File "/usr/local/Cellar/python@3.9/3.9.0_5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "/usr/local/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 337, in run
      impl_tag, abi_tag, plat_tag = self.get_tag()
    File "/usr/local/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 260, in get_tag
      plat_name = get_platform(self.bdist_dir)
    File "/usr/local/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 52, in get_platform
      result = calculate_macosx_platform_tag(archive_root, result)
    File "/usr/local/lib/python3.9/site-packages/wheel/macosx_libfile.py", line 356, in calculate_macosx_platform_tag
      assert len(base_version) == 2
  AssertionError
  ----------------------------------------
  ERROR: Failed building wheel for markupsafe

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 5
  • Comments: 23 (17 by maintainers)

Commits related to this issue

Most upvoted comments

The fix in e6102e5 only works for Mac x86-64; it still fails on Apple Silicon.

@emeryberger, it actually works for Apple Silicon. Some packages will build their own separate dedicated environment with an old wheel version when installed (e.g. numpy). You need to write an issue for each package to make the wheel version >=0.36.1.

What’s happening? calculate_macosx_platform_tag is called with platform_tag being macosx-11-x86_64. Therefore base_version becomes (11, ), and this triggers the assert on line 356. I’m not actually sure why that assert is there, it seems contradictory with the check on len(base_version) above.

Even if we remove that assert, or the platform_tag were different: if MACOSX_DEPLOYMENT_TARGET=11 is set in the environment, then the code below will set base_version to deploy_target, which will be (11, ). That’s not wrong, but it will trigger another assert on line 371.

If I simply remove the two asserts, then I can run pip3 install markupsafe and I get this behaviour:

Collecting markupsafe
  Downloading MarkupSafe-1.1.1.tar.gz (19 kB)
Building wheels for collected packages: markupsafe
  Building wheel for markupsafe (setup.py) ... done
  Created wheel for markupsafe: filename=MarkupSafe-1.1.1-cp39-cp39-macosx_11_0_x86_64.whl size=16482 sha256=da3dc29e1dbf01ee611984e85a58e822211c599221d5e2cafe8ce5e15694ba53
  Stored in directory: /Users/fx/Library/Caches/pip/wheels/e0/19/6f/6ba857621f50dc08e084312746ed3ebc14211ba30037d5e44e
Successfully built markupsafe
Installing collected packages: markupsafe
Successfully installed markupsafe-1.1.1

I am not sure whether the platform tag macosx_11_0_x86_64 is what is expected here, or if it should be macosx_11_x86_64 (i.e., only recording the major macOS version).