chilly-holiday-77415
01/13/2023, 6:21 PM./pants package ::
in an AWS codebuild container. Following that thread, I’ve managed to use complete_platforms to build and test inside a local dev container, and added pex3 interpreter inspect --markers --tags
for both the codebuild container (where it builds in CI) and for my dev container (for local dev).
I still get the same error in Lambda though - am I doing something wrong, or do I need to build for the lambda’s runtime container too in complete_platforms?
chilly-holiday-77415
01/13/2023, 6:22 PM[ERROR] ResolveError: Failed to resolve requirements from PEX environment @ /var/task.
Needed cp39-cp39-manylinux_2_26_x86_64 compatible dependencies for:
1: orjson>=3.2.1; extra == "all"
Required by:
fastapi 0.89.1
But this pex had no ProjectName(raw='orjson', normalized='orjson') distributions.
...
enough-analyst-54434
01/13/2023, 6:24 PMunzip -qc your.pex PEX-INFO | jq .
enough-analyst-54434
01/13/2023, 6:25 PMchilly-holiday-77415
01/13/2023, 6:28 PMenough-analyst-54434
01/13/2023, 6:29 PMorjson-3.8.5-cp39-cp39-manylinux_2_28_x86_64.whl
enough-analyst-54434
01/13/2023, 6:30 PMenough-analyst-54434
01/13/2023, 6:30 PMchilly-holiday-77415
01/13/2023, 6:30 PMpython_awslambda(
name="externalapilambda",
runtime="python3.9",
handler="main.py:external_api_handler",
complete_platforms=(
"3rdparty/platforms:codebuild",
"3rdparty/platforms:devcontainer",
),
)
enough-analyst-54434
01/13/2023, 6:30 PMchilly-holiday-77415
01/13/2023, 6:31 PMenough-analyst-54434
01/13/2023, 6:31 PMenough-analyst-54434
01/13/2023, 6:31 PMchilly-holiday-77415
01/13/2023, 6:32 PMenough-analyst-54434
01/13/2023, 6:33 PMenough-analyst-54434
01/13/2023, 6:33 PMenough-analyst-54434
01/13/2023, 6:33 PMchilly-holiday-77415
01/13/2023, 6:34 PMchilly-holiday-77415
01/13/2023, 6:34 PMpublic.ecr.aws/lambda/python:3.9
is actually the execution environment lambda runs in natively 🙂enough-analyst-54434
01/13/2023, 6:35 PMenough-analyst-54434
01/13/2023, 6:35 PMchilly-holiday-77415
01/13/2023, 6:36 PMldd --version
?enough-analyst-54434
01/13/2023, 6:36 PMenough-analyst-54434
01/13/2023, 6:36 PMchilly-holiday-77415
01/13/2023, 6:36 PMchilly-holiday-77415
01/13/2023, 6:36 PMenough-analyst-54434
01/13/2023, 6:36 PMenough-analyst-54434
01/13/2023, 6:37 PMenough-analyst-54434
01/13/2023, 6:37 PMenough-analyst-54434
01/13/2023, 6:37 PMchilly-holiday-77415
01/13/2023, 6:39 PMpip install pex; pex3 interpreter inspect --markers --tags
in the lambda env right?enough-analyst-54434
01/13/2023, 6:40 PMenough-analyst-54434
01/13/2023, 6:40 PMchilly-holiday-77415
01/13/2023, 6:41 PMenough-analyst-54434
01/13/2023, 6:41 PMchilly-holiday-77415
01/13/2023, 6:42 PMenough-analyst-54434
01/13/2023, 6:42 PMchilly-holiday-77415
01/13/2023, 6:42 PMenough-analyst-54434
01/13/2023, 6:42 PMchilly-holiday-77415
01/13/2023, 6:42 PMenough-analyst-54434
01/13/2023, 6:43 PMchilly-holiday-77415
01/13/2023, 8:15 PM{
"path": "/var/lang/bin/python3.9",
"compatible_tags": [
"cp39-cp39-manylinux_2_26_x86_64",
...
but redeploying still failed 😕 I can’t see an obvious misconfig in my build files - I assume this should be working?
(I didn’t manage to check within lambda yet - apparently not as simple as I’d hoped).enough-analyst-54434
01/13/2023, 8:22 PMchilly-holiday-77415
01/13/2023, 9:29 PM./pants package ::
in a different container (the dev container) right?
21:26:05.93 [INFO] Wrote dist/projects.api/externalapilambda.zip
Runtime: python3.9
Complete platform: 3rdparty/platforms/docker_aws_codebuild_standard_5_0_x86_64.json
Complete platform: 3rdparty/platforms/docker_python_3_9_16_devcontainer_x86.json
Complete platform: 3rdparty/platforms/docker_python_3_9_lambda_x86.json
unzip -qc dist/projects.api/externalapilambda.zip PEX-INFO | jq . > out.json
in the PEX-INFO, which seems the problem?
"orjson-3.8.5-cp39-cp39-manylinux_2_28_x86_64.whl": "552321182e28a4150ae47f606a4693c7307f0806c6bdd7488372f0e8d47d491c",
enough-analyst-54434
01/13/2023, 9:36 PMenough-analyst-54434
01/13/2023, 9:37 PMchilly-holiday-77415
01/13/2023, 9:39 PMpython_awslambda(
name="externalapilambda",
runtime="python3.9",
handler="main.py:external_api_handler",
complete_platforms=(
# "3rdparty/platforms:codebuild",
# "3rdparty/platforms:devcontainer",
"3rdparty/platforms:awslambda",
),
)
PEX-INFO still contains "orjson-3.8.5-cp39-cp39-manylinux_2_28_x86_64.whl": "552321182e28a4150ae47f606a4693c7307f0806c6bdd7488372f0e8d47d491c",
enough-analyst-54434
01/13/2023, 9:39 PMchilly-holiday-77415
01/13/2023, 9:39 PM{
"path": "/var/lang/bin/python3.9",
"compatible_tags": [
"cp39-cp39-manylinux_2_26_x86_64",
enough-analyst-54434
01/13/2023, 9:40 PMchilly-holiday-77415
01/13/2023, 9:40 PMenough-analyst-54434
01/13/2023, 9:40 PMenough-analyst-54434
01/13/2023, 9:42 PMchilly-holiday-77415
01/13/2023, 9:43 PMenough-analyst-54434
01/13/2023, 9:43 PMchilly-holiday-77415
01/13/2023, 9:44 PMenough-analyst-54434
01/13/2023, 9:44 PMenough-analyst-54434
01/13/2023, 9:45 PMenough-analyst-54434
01/13/2023, 9:45 PMenough-analyst-54434
01/13/2023, 9:46 PMenough-analyst-54434
01/13/2023, 9:47 PMenough-analyst-54434
01/13/2023, 9:48 PMchilly-holiday-77415
01/13/2023, 9:48 PMFailed to resolve for platform linux_x86_64-cp-39-cp39. Resolve requires evaluation of unknown environment marker: 'python_full_version' does not exist in evaluation environment.
which is (iirc) what put me on the remote build pathenough-analyst-54434
01/13/2023, 9:48 PMenough-analyst-54434
01/13/2023, 9:48 PMenough-analyst-54434
01/13/2023, 9:49 PMchilly-holiday-77415
01/13/2023, 9:51 PMenough-analyst-54434
01/13/2023, 9:51 PMruntime
enough-analyst-54434
01/13/2023, 9:51 PMenough-analyst-54434
01/13/2023, 9:51 PMchilly-holiday-77415
01/13/2023, 9:51 PMchilly-holiday-77415
01/13/2023, 9:52 PMenough-analyst-54434
01/13/2023, 9:53 PMenough-analyst-54434
01/13/2023, 9:55 PMchilly-holiday-77415
01/13/2023, 9:55 PM"orjson-3.8.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl": "9dbb9375310a5b24cae206e7a84b892c0af38299628474aa27dbd386985ecacc",
"orjson-3.8.5-cp39-cp39-manylinux_2_28_x86_64.whl": "552321182e28a4150ae47f606a4693c7307f0806c6bdd7488372f0e8d47d491c",
enough-analyst-54434
01/13/2023, 9:56 PMchilly-holiday-77415
01/13/2023, 9:56 PMenough-analyst-54434
01/13/2023, 9:56 PMenough-analyst-54434
01/13/2023, 9:56 PMchilly-holiday-77415
01/13/2023, 9:56 PMchilly-holiday-77415
01/13/2023, 9:57 PMenough-analyst-54434
01/13/2023, 9:57 PMenough-analyst-54434
01/13/2023, 9:57 PMchilly-holiday-77415
01/13/2023, 9:58 PMenough-analyst-54434
01/13/2023, 9:59 PMchilly-holiday-77415
01/13/2023, 11:07 PMchilly-holiday-77415
01/13/2023, 11:08 PMfastapi[all]
install (which brought in a bunch of these C deps) was getting dragged back two years to a 0.58.1 version because of (I think)
Dependency on python-multipart not satisfied, 1 incompatible candidate found:
1.) python-multipart 0.0.5 (via: fastapi[all] -> python-multipart>=0.0.5; extra == "all") does not have any compatible artifacts:
<https://files.pythonhosted.org/packages/46/40/a933ac570bf7aad12a298fc53458115cc74053474a72fbb8201d7dc06d3d/python-multipart-0.0.5.tar.gz>
but I don’t need that thankfully so will just rework my lock file.enough-analyst-54434
01/14/2023, 6:40 PMenough-analyst-54434
01/14/2023, 6:40 PMI had to manually upload the lambdex .zip from my mac rather than deploy it through a linux-based pipeline though which still seemed to fail with a ResolveError, which I’m assuming (?) is related to the same problem we had building on my linux ec2 box?That's probably right. You can try to upgrade to latest Pex to solve. That would look like this in your `pants.toml`:
[pex-cli]
version = "v2.1.120"
known_versions = [
"v2.1.120|macos_arm64|c8f2db310ea3e6dd400689b5993667a877d8540a4d206355fa102fff1d146ec0|4071055",
"v2.1.120|macos_x86_64|c8f2db310ea3e6dd400689b5993667a877d8540a4d206355fa102fff1d146ec0|4071055",
"v2.1.120|linux_x86_64|c8f2db310ea3e6dd400689b5993667a877d8540a4d206355fa102fff1d146ec0|4071055",
"v2.1.120|linux_arm64|c8f2db310ea3e6dd400689b5993667a877d8540a4d206355fa102fff1d146ec0|4071055"
]
[lambdex]
lockfile = "you/choose/a/path/in/your/repo/lambdex.lock
I'm pretty sure only the [lambdex]
section is needed, so you might try just that 1st. Either way, you then need to run:
./pants generate-lockfiles --resolve=lambdex
That will lock lambdex at the path you specified and you should inspect that file (~JSON, but Pants is frustrating here and adds an invalid comment header) and ensure the locked version of Pex is 2.1.120. That file should be checked in. You can get rid of it and the new pants.toml config once upgraded to Pants 2.16.x or newer.