green-match-60388
08/29/2023, 11:30 PM❯ pants run src/py/blah:docker
17:27:32.55 [INFO] Completed: Building docker image app:latest
Failed to find compatible interpreter on path /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.
Examined the following interpreters:
1.) /usr/local/bin/python3.10 CPython==3.10.13
No interpreter compatible with the requested constraints was found:
A distribution for cryptography could not be resolved for /usr/local/bin/python3.10.
Found 1 distribution for cryptography that do not apply:
1.) The wheel tags for cryptography 41.0.3 are cp37-abi3-macosx_10_12_universal2 which do not match the supported tags of /usr/local/bin/python3.10:
cp310-cp310-manylinux_2_36_aarch64
... 517 more ...
i've tried a few --platform iterations to no avail. also started to look at the experimental environments(docker_environment in particular). but i'm really struggling to get a PEX to run in a container.broad-processor-92400
08/29/2023, 11:33 PMBUILD file? Especially the pex_binary target?
Also, https://github.com/pantsbuild/pants/discussions/18756 might be very relevant to you. It describes what we do for cross-building linux docker images from a macOS hostgreen-match-60388
08/29/2023, 11:34 PMgreen-match-60388
08/29/2023, 11:35 PMbroad-processor-92400
08/29/2023, 11:42 PMplatforms or complete_platforms in some form, or else the PEX binary will be only compatible with the host that pants is running on (i.e. macOS), not necessarily the docker image.
From a quick glance, the platforms args may not be working because they use the m suffix which apparently doesn't apply in 3.8 and newer. I don't know what the exact correct form is, as we use complete_platforms JSON files appropriate for the specific docker image we're building for (that discussion has how to compute them)enough-analyst-54434
08/29/2023, 11:52 PM$ python3.10 -mvenv example.venv
$ example.venv/bin/pip install pex
$ example.venv/bin/pex --help | grep -A25 "\--platform "
--platform PLATFORMS, --abbreviated-platform PLATFORMS
The (abbreviated) platform to build the PEX for. This
option can be passed multiple times to create a multi-
platform pex. To use the platform corresponding to the
current interpreter you can pass `current`. To target
any other platform you pass a string composed of
fields: <platform>-<python impl abbr>-<python
version>-<abi>. These fields stem from wheel name
conventions as outlined in
<https://www.python.org/dev/peps/pep-0427#file-name->
convention and influenced by
<https://www.python.org/dev/peps/pep-0425>. For the
current interpreter at
/home/jsirois/dev/pantsbuild/jsirois-
pex/example.venv/bin/python3.10 the full platform
string is manylinux_2_35_x86_64-cp-3.10.12-cp310. To
find out more, try `PEX_TOOLS=1 example.venv/bin/pex
interpreter --all --verbose --indent 4` to print out
the platform for all interpreters on the $PATH or
`PEX_TOOLS=1 /home/jsirois/dev/pantsbuild/jsirois-
pex/example.venv/bin/python3.10 example.venv/bin/pex
interpreter --verbose --indent 4` to inspect the
single interpreter
/home/jsirois/dev/pantsbuild/jsirois-
pex/example.venv/bin/python3.10. (default: [])
--complete-platform COMPLETE_PLATFORMS
Note the example in the help string:
For the current interpreter at /home/jsirois/dev/pantsbuild/jsirois-pex/example.venv/bin/python3.10 the full platform string is manylinux_2_35_x86_64-cp-3.10.12-cp310.
So that's manylinux_2_35_x86_64-cp-3.10.12-cp310. Pants supplies the --manylinux flag separately though; so you want just linux_x86_64-cp-3.10.12-cp310. Note this includes the patch version (12), you can also try linux_x86_64-cp-310-cp310 (no patch version), but this is even less precise and will outright fail for any dependency that specifies an environment marker of python_full_version - which requires the patch.green-match-60388
08/30/2023, 6:58 PMpex3 interpreter commands to get the json and building a pex with that seems to work. next step trying to get the docker container to be happy.green-match-60388
08/30/2023, 6:59 PM