white-jordan-40851
09/19/2023, 8:09 PMpython_awslambda
, in a similar fashion as a pex_binary
:
pex_binary(
name="performance_profile",
entry_point="performance_profile.py",
interpreter_constraints=["==3.11.*"],
dependencies=[":src"],
)
python_awslambda(
name="lambda_performance_profile",
runtime="python3.11",
handler="lambda_function.py:performance_profile_handler",
dependencies=[":src"],
)
I can create and run the pex file, but I am struggling with this error for the second use case :
stderr:
Failed to resolve requirements from PEX environment @ /home/..
Needed cp311-cp311-linux_x86_64 compatible dependencies for:
1: pillow>=6.2.0
Required by:
matplotlib 3.8.0
But this pex had no ProjectName(raw='pillow', normalized='pillow') distributions.
which I tried to solve by explicitly adding pillow
to the dependencies. But then I encounter an other error :
stderr:
A distribution for pillow could not be resolved for cp311-cp311-linux_x86_64.
Found 1 distribution for pillow that do not apply:
1.) The wheel tags for Pillow 9.5.0 are cp311-cp311-manylinux_2_28_x86_64 which do not match the supported tags of cp311-cp311-linux_x86_64:
cp311-cp311-manylinux2014_x86_64
... 113 more ...
that is, I'm afraid, as far as I could get. How come the supported tag does not mention manylinux
? how does the dependency resolver differ between python_awslambda
and pex_binary
?broad-processor-92400
09/19/2023, 8:27 PMwhite-jordan-40851
09/19/2023, 8:30 PMpants package
white-jordan-40851
09/19/2023, 8:30 PM[lambdex]
layout = "zip"
in pants.toml
broad-processor-92400
09/19/2023, 8:59 PMcomplete_platforms
parameter to the target to accurately convey which wheels need to be selected. In https://github.com/pantsbuild/pants/discussions/18756 I describe more about how/why to do this.
You can take the file from https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/awslambda/python/complete_platform_3.11-x86_64.json (Pants 2.18 has an extra feature to automatically provide an appropriate file)white-jordan-40851
09/19/2023, 9:21 PMenough-analyst-54434
09/19/2023, 9:33 PMpex_binary
is built for a local interpreter but the python_awslambda
is built for a foreign interpreter (the one the AWS Lamba runtime provides). What Pants version is this? The answer is complete_platforms, but how you set that up depends on the Pants version.broad-processor-92400
09/19/2023, 9:57 PMenough-analyst-54434
09/19/2023, 11:19 PM