nice-eye-10512
08/31/2023, 5:40 PM2.17.0
and switched lambda zip format to "zip" instead of lambdex. I have some new errors and I am not sure how to solve them:
Needed cp39-cp39-linux_x86_64 compatible dependencies for:
1: Pillow
Required by:
amazon-textract-textractor 1.3.2
But this pex had no ProjectName(raw='Pillow', normalized='pillow') distributions.
2: Pillow>=9.4.*
Required by:
amazon-textract-pipeline-pagedimensions 0.0.8
But this pex had no ProjectName(raw='Pillow', normalized='pillow') distributions.
and
Found 1 distribution for pillow that do not apply:
1.) The wheel tags for Pillow 10.0.0 are cp39-cp39-manylinux_2_28_x86_64 which do not match the supported tags of cp39-cp39-linux_x86_64:
cp39-cp39-manylinux2014_x86_64
Would you have any clue on how I could resolve that ? Thanks !enough-analyst-54434
08/31/2023, 6:19 PMplatforms
instead of complete_platforms
is the short answer. The short solution is do like it shows here: https://www.pantsbuild.org/docs/awslambda-python#step-2-define-a-python_awslambda-target - @broad-processor-92400 made it easier to use complete_platforms
in 2.17.+ (they now get used on your behalf without you having to configure them explicitly) and now saying less in your BUILD target gets you more. Before trying that though, please paste your existing python_awslambda
target that is failing to confirm this direction is correct.enough-analyst-54434
08/31/2023, 6:21 PMenough-analyst-54434
08/31/2023, 6:22 PMpants.toml
edit it shows:
[lambdex]
layout = "zip"
Is needed in addition to ditching platforms
in your target.nice-eye-10512
08/31/2023, 6:46 PMplatforms
in my target. I merely specify the runtime
:
python_awslambda(
name="lambda",
runtime="python3.9",
handler="my.lambda_runner:lambda_handler",
dependencies=[":bot"],
)
nice-eye-10512
08/31/2023, 6:47 PM2.16.0
as well. I did not see the platforms
attribute on the target.enough-analyst-54434
08/31/2023, 6:47 PMplatforms
behind the scenes IIRC. If you make the pants.toml
edit above, that should change automagically to use complete_platforms
.enough-analyst-54434
08/31/2023, 6:47 PMnice-eye-10512
08/31/2023, 6:52 PMenough-analyst-54434
08/31/2023, 6:52 PMpants.toml
edit. Is that not so?nice-eye-10512
08/31/2023, 6:54 PM2.17
but had to fallback to layout=lambdex
(with the old handler names) to make this works.nice-eye-10512
08/31/2023, 6:55 PMpython_awslambda
targets are using runtime
attributes.enough-analyst-54434
08/31/2023, 6:55 PMlayout=lambdex
- you need do nothing.enough-analyst-54434
08/31/2023, 6:55 PMnice-eye-10512
08/31/2023, 6:55 PMnice-eye-10512
08/31/2023, 6:57 PM[lambdex]
layout = "zip"
⢠Switched entrypoint
from lambdex.handler -> lambda.handlerenough-analyst-54434
08/31/2023, 6:58 PMnice-eye-10512
08/31/2023, 6:58 PMenough-analyst-54434
08/31/2023, 6:59 PMnice-eye-10512
08/31/2023, 6:59 PMenough-analyst-54434
08/31/2023, 6:59 PMpkill pantsd
pants <whatever it is you run>
If you don't have pkill, just make sure the pants daemon pantsd
process is dead before running your pants command.enough-analyst-54434
08/31/2023, 7:03 PM"cp39-cp39-manylinux_2_26_x86_64"
, and so from Pillow 10.0's files (https://pypi.org/project/Pillow/#files),
Pillow-10.0.0-cp39-cp39-manylinux_2_28_x86_64.whl
should be rejected but
Pillow-10.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
should be selected.enough-analyst-54434
08/31/2023, 7:04 PMnice-eye-10512
08/31/2023, 7:04 PMnice-eye-10512
08/31/2023, 7:04 PMenough-analyst-54434
08/31/2023, 7:04 PMnice-eye-10512
08/31/2023, 7:09 PMnice-eye-10512
08/31/2023, 7:13 PMPANTS_PANTSD=false
?enough-analyst-54434
08/31/2023, 7:13 PMnice-eye-10512
08/31/2023, 7:14 PM19:13:48.64 [WARN] DEPRECATED: using a `pants` launcher binary older than 0.10.0 is scheduled to be removed in version 2.18.0.dev6.
enough-analyst-54434
08/31/2023, 7:14 PMnice-eye-10512
08/31/2023, 7:16 PM>> PANTS_PANTSD=false pants package my/target/lambda::
19:13:48.64 [WARN] DEPRECATED: using a `pants` launcher binary older than 0.10.0 is scheduled to be removed in version 2.18.0.dev6.
Run `PANTS_BOOTSTRAP_VERSION=report pants` to see the current version of the `pants` launcher binary, and see <https://www.pantsbuild.org/v2.17/docs/installation> for how to upgrade.
19:14:54.34 [INFO] Completed: Building 22 requirements for faas_repository.pex from the pants.lock resolve: aws-lambda-powertools[aws-sdk]==2.23.0, aws-lambda-typing==2.17.1, boto3==1.28.30, botocore-stubs==1.31.30, botocore==1.31... (417 characters truncated)
19:14:56.84 [INFO] Completed: Build python_awslambda artifact for my/target/lambda:lambda
19:14:56.84 [ERROR] 1 Exception encountered:
Engine traceback:
in `package` goal
ProcessExecutionFailure: Process 'Build python_awslambda artifact for my/target/lambda:lambda' failed with exit code 1.
stdout:
stderr:
A distribution for pillow could not be resolved for cp39-cp39-linux_x86_64.
Found 1 distribution for pillow that do not apply:
1.) The wheel tags for Pillow 10.0.0 are cp39-cp39-manylinux_2_28_x86_64 which do not match the supported tags of cp39-cp39-linux_x86_64:
cp39-cp39-manylinux2014_x86_64
... 95 more ...
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
enough-analyst-54434
08/31/2023, 7:18 PM__run.sh
here?nice-eye-10512
08/31/2023, 7:23 PMcat __run.sh
#!/usr/bin/env bash
# This command line should execute the same process as pants did internally.
cd /tmp/pants-sandbox-18jY3e
env -i CPPFLAGS= LANG=C.UTF-8 LDFLAGS= PATH=$'/ide/bin/remote-cli:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin' PEX_IGNORE_RCFILES=true PEX_PYTHON=/home/gitpod/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.17.0/bin/python PEX_ROOT=.cache/pex_root PEX_SCRIPT=pex3 /home/gitpod/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.17.0/bin/python ./pex venv create --tmpdir .tmp --python-path $'/ide/bin/remote-cli:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin' $'--dest-dir=my.target/lambda' $'--pex-repository=faas_repository.pex' $'--layout=flat-zipped' --platform linux_x86_64-cp-39-cp39
nice-eye-10512
08/31/2023, 7:24 PM./faas_repository.pex/.deps/Pillow-10.0.0-cp39-cp39-manylinux_2_28_x86_64.whl
enough-analyst-54434
08/31/2023, 7:25 PM--platform linux_x86_64-cp-39-cp39
and not --complete-platform
.enough-analyst-54434
08/31/2023, 7:26 PMnice-eye-10512
08/31/2023, 7:27 PMYeah, so --platform linux_x86_64-cp-39-cp39 and not --complete-platform.
nice-eye-10512
08/31/2023, 7:27 PMnice-eye-10512
08/31/2023, 7:31 PMenough-analyst-54434
08/31/2023, 7:35 PMnice-eye-10512
08/31/2023, 7:36 PMenough-analyst-54434
08/31/2023, 7:38 PMfile(
name="aws-lambda-py39",
source="complete_platform_3.9-x86_64.json",
)
python_awslambda(
name="lambda",
runtime="python3.9",
complete_platforms=[":aws-lambda-py39"],
handler="my.lambda_runner:lambda_handler",
dependencies=[":bot"],
)
nice-eye-10512
08/31/2023, 7:39 PMruntime
, no ?enough-analyst-54434
08/31/2023, 7:39 PMpants --keep-sandboxes=always package my/target/lambda::
and observe the __run.sh
in the sandbox use --complete-platform
but not --platform
.nice-eye-10512
08/31/2023, 7:40 PMcomplete_platform_3.9-x86_64.json
nice-eye-10512
08/31/2023, 7:40 PMenough-analyst-54434
08/31/2023, 7:40 PMāļø I think we need to remove runtime, no ?I think that's only true for layout=lambdex after reading source code.
enough-analyst-54434
08/31/2023, 7:40 PMWhat's in thisThe contents of the file I linked to.
nice-eye-10512
08/31/2023, 7:41 PMenough-analyst-54434
08/31/2023, 7:41 PMnice-eye-10512
08/31/2023, 7:41 PMnice-eye-10512
08/31/2023, 7:41 PMenough-analyst-54434
08/31/2023, 7:43 PMenough-analyst-54434
08/31/2023, 7:43 PMenough-analyst-54434
08/31/2023, 7:44 PMnice-eye-10512
08/31/2023, 7:53 PMA single target is required for creating a flat sys.path directory entry.
There were 2 targets selected:
1. cp39-cp39-linux_x86_64
2. cp39-cp39-manylinux_2_26_x86_64
enough-analyst-54434
08/31/2023, 7:53 PM__run.sh
contents will be helpful.enough-analyst-54434
08/31/2023, 7:54 PMnice-eye-10512
08/31/2023, 7:54 PM#!/usr/bin/env bash
# This command line should execute the same process as pants did internally.
cd /tmp/pants-sandbox-Jpb74S
env -i CPPFLAGS= LANG=C.UTF-8 LDFLAGS= PATH=$'/ide/bin/remote-cli:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin' PEX_IGNORE_RCFILES=true PEX_PYTHON=/home/gitpod/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.17.0/bin/python PEX_ROOT=.cache/pex_root PEX_SCRIPT=pex3 /home/gitpod/.cache/nce/466c13d805cfedffe1debdc484ce9cda9c007101044055b736ba37e4fea056b3/bindings/venvs/2.17.0/bin/python ./pex venv create --tmpdir .tmp --python-path $'/ide/bin/remote-cli:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin' $'--dest-dir=my.target/lambda' $'--pex-repository=faas_repository.pex' $'--layout=flat-zipped' --platform linux_x86_64-cp-39-cp39 --complete-platform platforms/complete_platform_3.9-x86_64.json
enough-analyst-54434
08/31/2023, 7:54 PMenough-analyst-54434
08/31/2023, 7:55 PMnice-eye-10512
08/31/2023, 7:56 PMenough-analyst-54434
08/31/2023, 7:57 PMruntime=
was the final bit?nice-eye-10512
08/31/2023, 7:57 PMbroad-processor-92400
08/31/2023, 8:22 PM