flat-zoo-31952
10/20/2020, 7:27 PMroot@1247ee737d61:/code# ./app.pex --help
Failed to execute PEX file. Needed manylinux2014_x86_64-cp-36-cp36m compatible dependencies for:
1: PyYAML>=3.10; extra == "yaml"
Required by:
apispec==4.0.0; python_version >= "3.6"
But this pex only contains:
flat-zoo-31952
10/20/2020, 7:28 PMhundreds-father-404
10/20/2020, 7:34 PM>=3.6
.
You can inspect PEX-INFO
in app.pex
by using unzip
to see what compatibility it’s claiming to have, which will be based off of your Pants targets’ compatibility settings.
At build time, if you claim compatibility with >=3.6
, then at runtime, any interpreter meeting that constraint may be used. At build time, Pex will use all discovered valid interpreters to get relevant copies of each distribution; but if you didn’t have a Py36 interpreter available at build time, then your built .pex
won’t include cp36
wheels and runtime may fail. https://github.com/pantsbuild/pex/issues/1020 tracks redesigning this.wooden-thailand-8386
10/20/2020, 7:35 PMflat-zoo-31952
10/20/2020, 7:54 PMflat-zoo-31952
10/20/2020, 7:54 PMcompatibility="==3.8.*"
hundreds-father-404
10/20/2020, 7:59 PMlike the old pex was built for the wrong versionLike
dist/app.pex
was stale? Or you recently ran ./pants package
and Pants built the wrong thing?flat-zoo-31952
10/20/2020, 8:03 PMflat-zoo-31952
10/20/2020, 8:04 PMflat-zoo-31952
10/20/2020, 8:05 PMhundreds-father-404
10/20/2020, 8:06 PMi don’t think just changing the “compatibility” invalidated the cacheIt would only invalidate the cache if the final resulting compatibility changed. Compatibility is calculated by looking at the transitive closure; each target gets ANDed. If you had a downstream dep at
CPython==3.8
, or that was your global default and you had left off the compatibility
field, then the final result would be the same.hundreds-father-404
10/20/2020, 8:07 PMthe manylinux wheel problem ended up being a non-issue, but it’s a good point that @wooden-thailand-8386 brought up that this will not work for people developing on macYou can use the
platforms
field on pex_binary
to work around that, but, it requires that every single dep has a bdist already, rather than sdist.wooden-thailand-8386
10/20/2020, 8:10 PMpip install wheel
poetry export -f requirements.txt --without-hashes --dev | grep -v '^-e' > libs/3rdparty/constraints.txt
pip wheel -r libs/3rdparty/constraints.txt -w .wheels
and I do the same thing using a docker container:
docker run --rm -it \
-v "$(pwd)":/app \
python:3.7 \
/bin/bash -c """
apt-get update -qq;
apt-get install -y libsasl2-dev;
pip wheel -r /app/libs/3rdparty/constraints.txt -w /app/.wheels
"""
flat-zoo-31952
10/20/2020, 8:12 PMflat-zoo-31952
10/20/2020, 8:13 PMwooden-thailand-8386
10/20/2020, 8:15 PMflat-zoo-31952
10/20/2020, 8:15 PMhundreds-father-404
10/20/2020, 8:17 PMbut it does make sense that mac machines can’t easily natively compile code that can run inside a linux docker containerYeah, that’s a fundamental issue independent of Pants. For building the
pants.pex
that we release, we have two CI jobs that build all our wheels on old macOS and old Centos. For Py36, Py37, and Py38. Then we use those prebuilt wheels, rather than an index like PyPI.flat-zoo-31952
10/20/2020, 8:18 PMhundreds-father-404
10/20/2020, 8:18 PMa bunch of magical scripts to overcome mac oddnessWe’ve spent probably 2-3 weeks collectively trying to work around macOS weirdness with its system Python the past 3 months 🙃
wooden-thailand-8386
10/20/2020, 8:19 PMWe’ve spent probably 2-3 weeks collectively trying to work around macOS weirdness with its system Python the past 3 monthsGiphy trolled me 😞
flat-zoo-31952
10/20/2020, 8:19 PMwooden-thailand-8386
10/20/2020, 8:20 PMhundreds-father-404
10/20/2020, 8:20 PM/usr/bin
is on your $PATH
, then Pex may still end up using itflat-zoo-31952
10/20/2020, 8:21 PMhundreds-father-404
10/20/2020, 8:21 PMflat-zoo-31952
10/20/2020, 8:22 PMwooden-thailand-8386
10/20/2020, 8:22 PMwooden-thailand-8386
10/20/2020, 8:22 PMflat-zoo-31952
10/20/2020, 8:22 PMwooden-thailand-8386
10/20/2020, 8:23 PMpacman
? I actually use yay
flat-zoo-31952
10/20/2020, 8:23 PMwooden-thailand-8386
10/20/2020, 8:24 PMflat-zoo-31952
10/20/2020, 8:24 PMhundreds-father-404
10/20/2020, 8:27 PM