quaint-telephone-89068
02/10/2023, 2:09 AM--resolve-local-platforms, pex will still build dependencies using the local interpreter matching the --python flag, even when binary wheels exist.
When using rosetta Python (x86 emulation), this issue does not exist.
Reproduction - I have two venvs, one for m1 native (arm) and one for rosetta (x86)):
Note the binary wheel exists for grpcio for requested --platform. Using --complete-platform does not help.
# x86 works as expected - pulls the binary wheel and makes the pex
% pex --platform=manylinux2014_x86_64-cp-38-cp38 --python=python3.8 --pip-version=22.2.2 --resolver-version=pip-legacy-resolver grpcio==1.47.2 -o grpcio.pex
(x86-python) ~/src/issues/pex-python-flag
% unzip -l grpcio.pex | grep 'whl/$'
0 01-01-1980 00:00 .deps/grpcio-1.47.2-cp38-cp38-macosx_10_10_x86_64.whl/
0 01-01-1980 00:00 .deps/grpcio-1.47.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl/
0 01-01-1980 00:00 .deps/six-1.16.0-py2.py3-none-any.whl/
# same command in arm just starts building a wheel
pex --platform=manylinux2014_x86_64-cp-38-cp38 --python=python3.8 --pip-version=22.2.2 --resolver-version=pip-legacy-resolver grpcio==1.47.2 -o grpcio.pex -v
pex: Building pex :: Resolving distributions (grpcio==1.47.2) :: Resolving requirements. :: Resolving for:
/Users/shalabh/src/issues/pex-python-flag/arm-python/bin/python3.8
pex: Hashing pex pex: Hashing pex: 90.3ms
pex: Isolating pex: 0.1ms
pex: Building pex :: Resolving distributions (grpcio==1.47.2) :: Resolving requirements. :: Building distributions for:
BuildRequest(target=LocalInterpreter(id='Users.shalabh.src.issues.pex-python-flag.arm-python.bin.python3.8', platform=Platform(platform='macosx_12_0_arm64', impl='cp', version='3.8.16', version_info=(3, 8, 16), abi='cp38'), marker_environment=MarkerEnvironment(implementation_name='cpython', implementation_version='3.8.16', os_name='posix', platform_machine='arm64', platform_python_implementation='CPython', platform_release='21.6.0', platform_system='Darwin', platform_version='Darwin Kernel Version 21.6.0: Mon Aug 22 20:20:05 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T8101', python_full_version='3.8.16', python_version='3.8', sys_platform='darwin'), interpreter=PythonInterpreter('/Users/shalabh/src/issues/pex-python-flag/arm-python/bin/python3.8', PythonIdentity('/Users/shalabh/src/issues/pex-python-flag/arm-python/bin/python3.8', 'cp38', 'cp38', 'macosx_12_0_arm64', (3, 8, 16)))), source_path='/Users/shalabh/.pex/downloads/resolver_download.gmefuolk/Users.spex: Building /Users/shalabh/.pex/downloads/resolver_download.gmefuolk/Users.shalabh.src.issues.pex-python-flag.arm-python.bin.python3.8/grpcio-1.47.2.tar.gz to /Users/shalabh/.pex/built_wheels/sdists/grpcio-1.47.2.tar.gz/c7f888b067f2b1833a5670f20eeac2c6063039a23a99b799929de065c1b18692/cp38-cp38-macosx_12_0_arm64
<CTRL-C>
This has something to do with the --python flag because if I remove that, even arm quickly builds the pex from the pypi wheel.
pantsbuild/pexuser
02/10/2023, 5:09 AM