:man-raising-hand::skin-tone-2: Question on multi-...
# general
m
🙋🏻‍♂️ Question on multi-platform PEX builds. I am following this thread between @aloof-appointment-30987 and @brief-scientist-13682 in 2022, I have built most of targets as they discuss but at the final step, I am running into a error (full error in thread). Would anyone be able to help?
Copy code
pip:    ERROR: Preparing metadata (pyproject.toml) exited with 1
Copy code
22:19:40.00 [ERROR] 1 Exception encountered:

Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Building 6 requirements for src.python.server/server-binary.pex from the 3rdparty/python/requirements.lock resolve: anthropic==0.45.0, fastapi==0.115.7, pydantic==2.10.6, requests==2.32.3, types-requests==2.32.0.20241016, uvicorn==0.34.0' failed with exit code 1.
stdout:

stderr:
There were 2 errors downloading required artifacts:
1. jiter 0.8.2 from <https://files.pythonhosted.org/packages/f8/70/90bc7bd3932e651486861df5c8ffea4ca7c77d28e8532ddefe2abc561a53/jiter-0.8.2.tar.gz>
    pip:    ERROR: Preparing metadata (pyproject.toml) exited with 1
2. pydantic-core 2.27.2 from <https://files.pythonhosted.org/packages/fc/01/f3e5ac5e7c25833db5eb555f7b7ab24cd6f8c322d3a3ad2d67a952dc0abc/pydantic_core-2.27.2.tar.gz>
    pip:    ERROR: Preparing metadata (pyproject.toml) exited with 1
c
I believe doing multiplatform pex builds usually assumes that all of your transitive dependencies have wheels available (either from upstream or your own processes). There is not as far as I know a way for
pip
on linux to take
jiter-0.8.2.tar.gz
and build a mac wheel, or vise versa.
m
Yeah, but I think the wheels are available in PyPI. I don't understand even what the error means It's just opaque exit with 1.
For the next person who stumble across this thread. I solved this by widening my Python interpreter requirements in
pants.toml
Copy code
interpreter_constraints = ["CPython!=3.9.7,==3.9.*", "CPython==3.12.*"]
The Docker image has a different interpreter. If you use this hack you will need to relax the shebang.
Copy code
pex_binary(
    name="server-binary",
    ....
    shebang="#!/usr/bin/env python3",
)
It's not ideal but sometimes unavoidable...