abundant-tent-27407
11/12/2023, 2:30 PMProcessExecutionFailure: Process 'Building 2 requirements for src.python.example/main.pex from the python-default.lock resolve: fastapi<0.105.0,>=0.104.1, uvicorn<0.25.0,>=0.24.0.post1' failed with exit code 1.
stdout:
stderr:
There was 1 error downloading required artifacts:
1. pydantic-core 2.10.1 from <https://files.pythonhosted.org/packages/af/31/8e466c6ed47cddf23013d2f2ccf3fdb5b908ffa1d5c444150c41690d6eca/pydantic_core-2.10.1.tar.gz>
Docker env:
docker_environment(
name="python_bullseye",
platform="linux_x86_64",
image="python:3.11.6-bullseye@sha256:667f7084aaff6907534f1784ae6b58ccc409bb4bd8a24d9e02dee27584b9b2f7",
)
broad-processor-92400
11/13/2023, 2:04 AMdocker run python:3.11.6-bullseye@sha256:667f7084aaff6907534f1784ae6b58ccc409bb4bd8a24d9e02dee27584b9b2f7 pip install pydantic-core==2.10.1
or something like that.abundant-tent-27407
11/13/2023, 7:34 AMpex_binary(
name="main",
entry_point="__init__.py",
environment="python_bullseye",
platforms=[
"linux-x86_64-cp-311-cp311m"
]
)
abundant-tent-27407
11/13/2023, 7:38 AMbroad-processor-92400
11/13/2023, 8:13 AMplatforms
? (In theory, without that, it’ll just package to match the ambient platform, ie the Python and glibc versions/architectures in the docker image)abundant-tent-27407
11/13/2023, 9:31 AMabundant-tent-27407
11/13/2023, 9:31 AMabundant-tent-27407
11/13/2023, 9:40 AMFailed to find compatible interpreter on path /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.
Examined the following interpreters:
1.) /usr/bin/python3.11 CPython==3.11.2
No interpreter compatible with the requested constraints was found:
Failed to resolve requirements from PEX environment @ /root/.pex/unzipped_pexes/597e926d0c16c0ebf20e514f0960a7d731c3bd66.
Needed cp311-cp311-manylinux_2_36_aarch64 compatible dependencies for:
1: pydantic-core==2.10.1
Required by:
pydantic 2.4.2
But this pex had no ProjectName(raw='pydantic-core', normalized='pydantic-core') distributions.
broad-processor-92400
11/13/2023, 9:46 AMabundant-tent-27407
11/13/2023, 8:42 PM--platform=amd64
in my Dockerfile
pex_binary(
name="main",
entry_point="__init__.py",
shebang="#!/usr/bin/python",
platforms = [
"manylinux2014_x86_64-cp-311-cp311",
],
)
docker_image(
name="example_image",
)
Dockerfile
FROM --platform=amd64 <http://gcr.io/distroless/python3-debian12|gcr.io/distroless/python3-debian12>
COPY src.python.example/main.pex /bin/main.pex
ENTRYPOINT ["python", "/bin/main.pex"]
broad-processor-92400
11/13/2023, 10:01 PMbroad-processor-92400
11/13/2023, 10:02 PMcomplete_platforms
rather than platforms
: the platforms
is an approximation that can lead to unexpected choices of dependencies and thus errors. See https://github.com/pantsbuild/pants/discussions/18756 (particularly "Again, we use complete_platforms
to be able to build PEX files natively on macOS") for how this can work
• It's possible to better utilise the docker layer caching by splitting third-party requirements and first-party sources into their own PEXes and layers. See those recipes and https://blog.pantsbuild.org/optimizing-python-docker-deploys-using-pants/