late-manchester-49683
07/07/2023, 8:25 PMbroad-processor-92400
07/07/2023, 10:49 PMlate-manchester-49683
07/07/2023, 10:57 PMbroad-processor-92400
07/08/2023, 12:11 AM.deps
In addition, you might be interested in https://github.com/pantsbuild/pants/discussions/18756late-manchester-49683
07/08/2023, 12:15 AM.deps
. Folder has the correct dependencies when unzipped. The issue is the .bootstrap/pex folder’s dependencies which I don't think I have control over are if I'm not mistaken are added by pants?late-manchester-49683
07/08/2023, 12:16 AMlate-manchester-49683
07/08/2023, 12:17 AMbroad-processor-92400
07/08/2023, 12:21 AMlate-manchester-49683
07/08/2023, 12:32 AMlate-manchester-49683
07/10/2023, 2:07 PM2.16.0
The 2nd error message was resolved by using a complete_platforms
file instead of the runtime
with python_awslambda
lemon-yak-80782
07/20/2023, 9:33 PMlate-manchester-49683
07/20/2023, 9:39 PMlemon-yak-80782
07/20/2023, 9:45 PMlemon-yak-80782
07/20/2023, 9:48 PMlate-manchester-49683
07/20/2023, 9:51 PMlate-manchester-49683
07/20/2023, 9:53 PMlate-manchester-49683
07/20/2023, 9:54 PMlemon-yak-80782
07/20/2023, 9:54 PMRuntime.ImportModuleError: Unable to import module 'lambdex_handler': cannot import name 'AttrsInstance' from 'pex.vendor._vendored.attrs.attr' (/var/task/.bootstrap/pex/vendor/_vendored/attrs/attr/__init__.py)
[10:17 PM] {
"errorMessage": "Failed to resolve requirements from PEX environment @ /var/task.\nNeeded cp39-cp39-manylinux_2_26_x86_64 compatible dependencies for:\n 1: bcrypt>=3.2\n Required by:\n paramiko 3.2.0\n But this pex had no ProjectName(raw='bcrypt', normalized='bcrypt') distributions.\n 2: cryptography>=3.3\n Required by:\n paramiko 3.2.0\n But this pex had no ProjectName(raw='cryptography', normalized='cryptography') distributions.",
lemon-yak-80782
07/20/2023, 9:54 PMlate-manchester-49683
07/20/2023, 9:54 PMlemon-yak-80782
07/20/2023, 9:54 PMlate-manchester-49683
07/20/2023, 9:55 PMlemon-yak-80782
07/20/2023, 9:55 PMlemon-yak-80782
07/20/2023, 9:55 PMlate-manchester-49683
07/20/2023, 9:56 PMlate-manchester-49683
07/20/2023, 9:56 PMlate-manchester-49683
07/20/2023, 9:56 PMlemon-yak-80782
07/20/2023, 9:57 PMlate-manchester-49683
07/20/2023, 9:58 PMlate-manchester-49683
07/20/2023, 11:23 PMlemon-yak-80782
07/21/2023, 9:13 AMlemon-yak-80782
07/21/2023, 11:02 AM@@ -1996,48 +2058,69 @@
"typing-extensions<5.0,>=3.7"
],
"requires_python": "~=3.7",
- "version": "1.84.0"
+ "version": "1.85.0"
},
{
"artifacts": [
{
"algorithm": "sha256",
- "hash": "a870ad254da1a8ca84b6a2905cac29d265f805acc57af304784962a2aa6508f6",
- "url": ""
+ "hash": "971be834317c22daaa9132340a51c01b50910724082c2c1a2ac87eeec153a3fe",
+ "url": "/jsonschema-4.18.4-py3-none-any.whl"
},
{
"algorithm": "sha256",
- "hash": "0f864437ab8b6076ba6707453ef8f98a6a0d512a80e93f8abdb676f737ecb60d",
- "url": "/jsonschema-4.17.3.tar.gz"
+ "hash": "fb3642735399fa958c0d2aad7057901554596c63349f4f6b283c493cf692a25d",
+ "url": "/jsonschema-4.18.4.tar.gz"
}
],
"project_name": "jsonschema",
"requires_dists": [
- "attrs>=17.4.0",
+ "attrs>=22.2.0",
"fqdn; extra == \"format\"",
"fqdn; extra == \"format-nongpl\"",
"idna; extra == \"format\"",
"idna; extra == \"format-nongpl\"",
- "importlib-metadata; python_version < \"3.8\"",
"importlib-resources>=1.4.0; python_version < \"3.9\"",
"isoduration; extra == \"format\"",
"isoduration; extra == \"format-nongpl\"",
"jsonpointer>1.13; extra == \"format\"",
"jsonpointer>1.13; extra == \"format-nongpl\"",
+ "jsonschema-specifications>=2023.03.6",
"pkgutil-resolve-name>=1.3.10; python_version < \"3.9\"",
- "pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0",
+ "referencing>=0.28.4",
"rfc3339-validator; extra == \"format\"",
"rfc3339-validator; extra == \"format-nongpl\"",
"rfc3986-validator>0.1.0; extra == \"format-nongpl\"",
"rfc3987; extra == \"format\"",
- "typing-extensions; python_version < \"3.8\"",
+ "rpds-py>=0.7.1",
"uri-template; extra == \"format\"",
"uri-template; extra == \"format-nongpl\"",
"webcolors>=1.11; extra == \"format\"",
"webcolors>=1.11; extra == \"format-nongpl\""
],
- "requires_python": ">=3.7",
- "version": "4.17.3"
+ "requires_python": ">=3.8",
+ "version": "4.18.4"
+ },
Fixing the jsonschema
version at 4.17.3 resolved the error for now. I am not sure why the local dependencies interfere with lambdex setup. Further, I am not even sure if this is actually the case.
@enough-analyst-54434 is it worth to open an ticket in the lambdex repository? Sorry, if I tagged the wrong person, but you have the most contributions to lambdex.enough-analyst-54434
07/21/2023, 8:17 PMlemon-yak-80782
07/21/2023, 8:26 PMjsonschema == 4.17.3
to my requirements file. Can the 3rd party dependencies interfere with lambdex/pex in any way?enough-analyst-54434
07/21/2023, 8:29 PMenough-analyst-54434
07/21/2023, 8:34 PMlemon-yak-80782
07/21/2023, 8:51 PM[ERROR] Runtime.ImportModuleError: Unable to import module 'lambdex_handler': cannot import name 'AttrsInstance' from 'pex.vendor._vendored.attrs.attr' (/var/task/.bootstrap/pex/vendor/_vendored/attrs/attr/__init__.py)
Traceback (most recent call last):
We run the .pex in a docker lambda. The runtime environment is python 3.10.
FROM public.ecr.aws/lambda/python:3.10
RUN yum install unzip -y && rm -rf /var/cache/yum
COPY some-path/lambda.zip .
RUN unzip -q lambda.zip -d "${LAMBDA_TASK_ROOT}"
RUN rm -r lambda.zip
CMD ["lambdex_handler.handler"]
We build .zip with:
python_awslambda(
name="lambda",
runtime="python3.10",
handler="lambda.py:handler",
)
Deployment is done via AWS-CDK.
I also added the .zip, with our source code removed.
Is there anything else I can provide you?enough-analyst-54434
07/21/2023, 8:58 PMenough-analyst-54434
07/21/2023, 8:58 PMenough-analyst-54434
07/21/2023, 9:08 PMpex: ...
lines above.enough-analyst-54434
07/21/2023, 9:08 PMlemon-yak-80782
07/21/2023, 9:12 PMenough-analyst-54434
07/22/2023, 4:38 PMlayout="zip"
to your python_awslambda
target to get Lambdex and Pex completely out of the picture at runtime. Are you in a position to try that with Pants 2.18.0.dev5?enough-analyst-54434
07/22/2023, 4:51 PMbash-4.2# diff -u .bootstrap/pex/pex_bootstrapper.py .bootstrap/pex/pex_bootstrapper.py.orig
--- .bootstrap/pex/pex_bootstrapper.py 2023-07-22 16:52:07.720031735 +0000
+++ .bootstrap/pex/pex_bootstrapper.py.orig 2023-07-22 16:43:47.570107642 +0000
@@ -700,11 +700,3 @@
from .environment import PEXEnvironment
PEXEnvironment.mount(entry_point, pex_info).activate()
-
- from . import third_party
- from .bootstrap import Bootstrap
- third_party.uninstall()
- bootstrap = Bootstrap.locate()
- bootstrap.demote()
- import pex
-
Since that's an easy fix and does not require new work on Lambdex - which, as I mentioned, is a dead man walking that I prefer not to invest time in, I'll get that fix rolled in to the Pex 2.1.139 release. I can provide more info here as soon as that's released that will allow you to upgrade to that Pex version while keeping your Pants version fixed at whatever it is today. That said - definitely switch to the layout="zip"
@broad-processor-92400 introduced in Pants 2.17.x as soon as you can.late-manchester-49683
07/22/2023, 4:54 PMenough-analyst-54434
07/22/2023, 4:56 PMlate-manchester-49683
07/22/2023, 4:59 PMlate-manchester-49683
07/22/2023, 5:01 PMenough-analyst-54434
07/22/2023, 5:08 PMenough-analyst-54434
07/22/2023, 5:10 PMenough-analyst-54434
07/22/2023, 5:10 PMlate-manchester-49683
07/22/2023, 5:11 PMlate-manchester-49683
07/22/2023, 5:12 PMenough-analyst-54434
07/22/2023, 5:12 PMpants.toml
setup here later if the issue comes back for you. But the same advice I offered @lemon-yak-80782 applies - switch to layout="zip"
as soon as you're on a Pants version that supports that. That kills Lambdex and gets you on a vanilla / as-reccommended by AWS zip.late-manchester-49683
07/22/2023, 5:19 PM[python]
interpreter_constraints = ["CPython==3.9.*"]
late-manchester-49683
07/22/2023, 5:21 PMenough-analyst-54434
07/22/2023, 5:49 PMzipinfo -1 my.pex | grep .deps/
).enough-analyst-54434
07/22/2023, 5:59 PMenough-analyst-54434
07/22/2023, 7:35 PMlemon-yak-80782
07/22/2023, 11:24 PMUnrecognized field `layout=zip` in target src/python/mdl-history/mdl_history/lambda_handler:data-processor-lambda. Valid fields for the target type `python_aws_lambda_function`: ['complete_platforms', 'dependencies', 'description', 'environment', 'handler', 'include_requirements', 'output_path', 'resolve', 'runtime', 'tags'].
Anyway, my preferred way is to update the Pex version (when it is released) in my pants.toml until 2.17 is released as stable. Then I will switch to layout="zip"
. I don’t want to risk running our build tool on a potentially unstable version if I don’t have to.enough-analyst-54434
07/23/2023, 6:18 PM[lambdex]
layout = "zip"
See here: https://www.pantsbuild.org/v2.17/docs/reference-lambdex#layout
As for the Pex fix, you can use that now by adding the following to `pants.toml`:
[pex-cli]
version = "v2.1.139"
known_versions = [
"v2.1.139|macos_arm64|56761f3feb10a632ed82f590ad1fd49f3bdeb6785a48956abe6e5da9488a5305|4103625",
"v2.1.139|macos_x86_64|56761f3feb10a632ed82f590ad1fd49f3bdeb6785a48956abe6e5da9488a5305|4103625",
"v2.1.139|linux_x86_64|56761f3feb10a632ed82f590ad1fd49f3bdeb6785a48956abe6e5da9488a5305|4103625",
"v2.1.139|linux_arm64|56761f3feb10a632ed82f590ad1fd49f3bdeb6785a48956abe6e5da9488a5305|4103625"
]
lemon-yak-80782
07/24/2023, 1:24 PMpex-cli
to the pants.toml
fixed it for us. I am gonna try out the layout="zip"
approach if I find the time.billowy-tiger-59247
09/05/2023, 3:34 PMpex-cli
to v2.1.139. The error is:
ImportError: cannot import name 'AttrsInstance' from 'pex.vendor._vendored.attrs.attr'
which happens when a transitive dependency tries to import AttrsInstance
from the attr
module.
debugging:
I increased the verbosity to confirm that the vendored attr was, at least according to the logs, un-imported
pex: un-imported <module 'pex.vendor._vendored.attrs.attr' from '/.pex/unzipped_pexes/51625a6fbd01b68370a16c38cd520f842deca7a0/.bootstrap/pex/vendor/_vendored/attrs/attr/__init__.py'>
I’ve also checked that PYTHONPATH includes the attrs
package (non-vendored) before the .bootstrap
folder. The weird thing, is that the correct attrs
module is properly imported, but the attr
(which should be packaged together ) is pointing to pex.vendor._vendored.attrs.attr
billowy-tiger-59247
09/05/2023, 3:42 PMattr
namespace seem to be coming from the vendored attr
. Any suggestions on how to debug this further?enough-analyst-54434
09/05/2023, 3:59 PMenough-analyst-54434
09/05/2023, 4:00 PMenough-analyst-54434
09/05/2023, 4:38 PMbillowy-tiger-59247
09/05/2023, 4:53 PMpython_awslambda
target, though. I’m using the pex_binary
directly
• the unvendored attrs package version is 23.1.0
• the import order is:
◦ sagemaker==2.182.0
imports jsonschema
◦ jsonschema==4.19.0
imports attrs
◦ attrs==23.1.0
imports attr
enough-analyst-54434
09/05/2023, 5:02 PMbillowy-tiger-59247
09/05/2023, 5:09 PMpex-bin
version to 2.1.139, the issue still appearsenough-analyst-54434
09/05/2023, 5:10 PMbillowy-tiger-59247
09/05/2023, 5:14 PMCPython==3.8.*
enough-analyst-54434
09/05/2023, 5:14 PMenough-analyst-54434
09/05/2023, 5:30 PMexecution_mode="venv"
anyway. I assume you're not.enough-analyst-54434
09/05/2023, 5:32 PM$ pex --python python3.8 sagemaker==2.182.0 jsonschema==4.19.0 attrs==23.1.0 -o test.pex
$
$ # Noop:
$ time ./test.pex -c ''
real 0m0.905s
user 0m0.807s
sys 0m0.043s
$
$ # Just import sagemaker:
$ time ./test.pex -c 'import sagemaker'
real 0m13.468s
user 0m1.637s
sys 0m0.978s
billowy-tiger-59247
09/05/2023, 5:33 PMenough-analyst-54434
09/05/2023, 5:33 PMenough-analyst-54434
09/05/2023, 5:33 PMbillowy-tiger-59247
09/05/2023, 5:35 PMbillowy-tiger-59247
09/05/2023, 5:38 PMfrom sagemaker.s3 import S3Uploader
enough-analyst-54434
09/05/2023, 5:41 PM$ pex -V
2.1.145
$ time ./test.pex -c 'from sagemaker.s3 import S3Uploader'
real 0m13.531s
user 0m1.681s
sys 0m1.015s
billowy-tiger-59247
09/05/2023, 5:43 PMenough-analyst-54434
09/05/2023, 5:45 PMlemon-yak-80782
09/05/2023, 5:46 PMenough-analyst-54434
09/05/2023, 5:47 PMenough-analyst-54434
09/05/2023, 5:47 PMenough-analyst-54434
09/05/2023, 5:47 PMlemon-yak-80782
09/05/2023, 5:49 PMenough-analyst-54434
09/05/2023, 5:49 PMbillowy-tiger-59247
09/05/2023, 5:52 PMexecution_mode=venv
is doing the trick for us, so I’ll change it while I gather more data to reproduce the issue.lemon-yak-80782
09/05/2023, 5:54 PMenough-analyst-54434
09/05/2023, 5:55 PMenough-analyst-54434
09/05/2023, 6:02 PM$ ./test.pex -c 'import sys; print("\n".join(mod for mod in sys.modules if mod.startswith("pex")))'
pex.version
pex
pex.typing
pex.compatibility
IOW, after the pex boots, those are the only pex*
modules. I don't see pex.vendor._vendored.attrs.attr
let alone pex.vendor
even.enough-analyst-54434
09/05/2023, 6:03 PMpex_binary
target look like? Can you paste that? Maybe better paste unzip -qc your.pex PEX-INFO | jq .
.billowy-tiger-59247
09/05/2023, 6:08 PMunzip -qc your.pex PEX-INFO | jq .
. I’ll add a breakpoint before the sagemaker import to see what are the pex*
modules available before the error
{
"bootstrap_hash": "a064045603ba298561942a56a3da3747949fa93f",
"build_properties": {
"pex_version": "2.1.139"
},
"code_hash": "a4a097655fef575bb0d71c9e0b2e1fefe64ebd52",
"distributions": {
"GitPython-3.1.34-py3-none-any.whl": "f69e1673d69bb3dd1358c0b66c6b65feb2a1366ad3316893517c0e03056d258e",
"Jinja2-2.11.3-py2.py3-none-any.whl": "8a18e3284e3369148048fa9af2ae04b61c512038a56a4f34883c81cfc00f221a",
"MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_universal2.whl": "f160fc1d89b834c3c8284b88944fa1a7b6369644857dafaadf8cacbe2869647f",
"PyYAML-6.0.1-cp38-cp38-macosx_13_0_arm64.whl": "b6c511fbc584cb75c53aaf7196f25455e3790735e177576ae4e80bd535e41fd9",
"Pygments-2.16.1-py3-none-any.whl": "9a5ace6bc85edf3d79b456f7caa713ad39bba73b03f8b0da03e004dd22cfe624",
"anyio-4.0.0-py3-none-any.whl": "925cf2cab75f7910d3ca514d28e203258692c39646ddb96a348f963725ecbdb1",
"arrow-1.2.3-py3-none-any.whl": "093fc3cd56b645c0f4ef57c194d2222b27aa5147efb68ef6ccc14c7b6e571529",
"attrs-23.1.0-py3-none-any.whl": "6c3861638ec4fd267653f203e53754b70438c2d0696a8955f9eb6345b1c3bb48",
"awswrangler-3.3.0-py3-none-any.whl": "21d6cac3c5502eae00ae7a4d69184e5688e56a11d16e40a9be655e574ecbe34c",
"binaryornot-0.4.4-py2.py3-none-any.whl": "7798e44237367e15ebfe0d25ca43ec0453a10290b401678e1beb4c242dabe1f4",
"boto3-1.28.40-py3-none-any.whl": "c582724acddfdf2794cd41e8bd392f2e3a396cdcef2c29c7062a98786691b3b5",
"botocore-1.31.40-py3-none-any.whl": "c186a150f4a1e28e8a98b81c17c5b1a88bf510f4f4022ff88e284aef6448fa9e",
"certifi-2023.7.22-py3-none-any.whl": "41972ef3880e7aeb1cf9f271e4f80f9df401f5ceb5f585fb3c2ee8b6500b4788",
"chardet-5.2.0-py3-none-any.whl": "3444f1caec835239744916f414f002a736e1e050efc52c1352ed87dd25592e60",
"charset_normalizer-3.2.0-cp38-cp38-macosx_11_0_arm64.whl": "94f8f44c9787603f156c34b42c76b9de9f8ad0820728f756085726532da5615d",
"click-8.1.7-py3-none-any.whl": "e0ff3997898ca5b6bfc3d8c11d1daff31c89eec22f38ceab6fc6f7d41c898d5d",
"cloudpickle-2.2.1-py3-none-any.whl": "5e507b687a53f60ec719f5beecb87c447721de298cbd1ee0e34de2c94b72b03d",
"contextlib2-21.6.0-py2.py3-none-any.whl": "022eb42df50d1724cdf14142be24650c8c0eee54f81d72fd3fd60f46830de93d",
"cookiecutter-2.3.0-py3-none-any.whl": "14dd801060060dfb3dcccba6639657ac0af4f0c08c616667401d33606febb9f3",
"databricks_sdk-0.8.0-py3-none-any.whl": "0531e75f59f737c344617a2ec64dd50f5a36c0711f49ad784575b80e976a2de2",
"dill-0.3.7-py3-none-any.whl": "afaaddaf810630ef34227c2af6f927734691ebe91158f82c90ee1dd17c43b60e",
"exceptiongroup-1.1.3-py3-none-any.whl": "843e07b90a2d689c6034c0ecd0bae83bd61bddc53a2fd25646cfc8f7c3f762b2",
"gitdb-4.0.10-py3-none-any.whl": "dc2aa23fc023a7c1a29edd7b1d3c37078a388d3c6781a7f11896894f81e6939c",
"google_pasta-0.2.0-py3-none-any.whl": "aae70d694fda15d7a6b20beb89c904c4ddbcb28d756f0db133c4e4d94727baea",
"idna-3.4-py3-none-any.whl": "3baea0ffbdea9f349783bacbdb82dbd50eadfec75339388aaf1597754786e3ed",
"importlib_metadata-6.8.0-py3-none-any.whl": "61e6097ed68695b9d7d77e89b8dcab92163d0c6d3a84a11e50d5deaa79b1632a",
"importlib_resources-6.0.1-py3-none-any.whl": "dbd5cae79fd4ab8126a895b72ed2adfb19badca335be88a8f7e5de45aee4a3bf",
"jmespath-1.0.1-py3-none-any.whl": "299c3a18595a39d4d54252e98a3c39343899b9bd1997e3eebfee63ea5757588b",
"jsonschema-4.19.0-py3-none-any.whl": "48881fb45d271ae04c9540764c96525deb809bc05d49eea0b9518a0a08767aac",
"jsonschema_specifications-2023.7.1-py3-none-any.whl": "19c57dbff23ee1e94b00322dc033a6e825535c7ad1115bddb19fe18b1404cdaf",
"markdown_it_py-3.0.0-py3-none-any.whl": "5283bd369e168609df0b6af247b2b8e724a9a3d6d9812481b2eca026608d530b",
"mdurl-0.1.2-py3-none-any.whl": "43d69334b85db19da8afaf9583f4b6033d1874e9b7419b6aa4cac68292f061f2",
"multiprocess-0.70.15-py38-none-any.whl": "d58349bfbe6d500eba85b3cb815b44f7d7c3b200ca8decfe4d3d3dbb49367657",
"numpy-1.23.5-cp38-cp38-macosx_11_0_arm64.whl": "606be144a2d9de59d4d6399ab648bef17dbff8dcfff7d395def25e9d868f1956",
"packaging-23.1-py3-none-any.whl": "8b3aa0966620e42b8b5bddab8e11f6f65ba78f4d885786d7e2d50efbdfcda19e",
"pandas-1.5.3-cp38-cp38-macosx_11_0_arm64.whl": "07dd2201bd4430682f69cae46c46a177233a57ba3ca360c2216166ac43af5727",
"pathos-0.3.1-py3-none-any.whl": "48aeba80b7bac20ced27bed0108204852b6ecdf56e284cf6ebc30344ee707c8e",
"pkgutil_resolve_name-1.3.10-py3-none-any.whl": "0121081f2eebae9a497df26f92610864ab4875a38beb3d5015cab3ecad39e9b2",
"platformdirs-3.10.0-py3-none-any.whl": "5b27ddc6aa62c130ff012216374056073e011b56dc9569ce38bbc5fcb2acc1c0",
"pox-0.3.3-py3-none-any.whl": "4c0f203126015c5cb4d34961b19e59660880ce00451e2199ef73c0253f84e503",
"ppft-1.7.6.7-py3-none-any.whl": "30d11fd64aa37bccc552487fb5ec612a7358a435ad3aa290550daae20097ff7d",
"protobuf-3.20.3-py2.py3-none-any.whl": "9a36cf1764b80d3b534a8829ebfd9f9e40be087c417fff94a63f6dd38edc1992",
"pyarrow-13.0.0-cp38-cp38-macosx_11_0_arm64.whl": "2f1dacd91066d9e0d312f0b989a1296164f36f0997863496d3777b8879582cf9",
"python_dateutil-2.8.2-py2.py3-none-any.whl": "202c27a293331dd8fa9d41d1fcdd5ba4f4d6d2de0a2f00fa8547adc7c1aac629",
"python_slugify-8.0.1-py2.py3-none-any.whl": "70d881acc57e232e80027924886fe94a1bc980bb3f5635748b89b35fbd9ae044",
"pytz-2023.3.post1-py2.py3-none-any.whl": "d1961115ba2d0eab86256042387b168cd0c4e9ab9aa56fcbdd07ac22250a1a5f",
"referencing-0.30.2-py3-none-any.whl": "21994a35d4e452eee5e42e20ad387b2d346cb997d540cb11aa7aa245637b9107",
"requests-2.31.0-py3-none-any.whl": "d1478462520ba69e97c257949e5c5b4552eac42920d4643a8625610aa1c4b999",
"rich-13.5.2-py3-none-any.whl": "6917b84a6269c2c098705bc2cec4c3df9dfbbe12dfbaafe92a1127789203cc96",
"rpds_py-0.10.2-cp38-cp38-macosx_11_0_arm64.whl": "81072a34c2da7c5da0b788b2b673e0c81851167e70f330e3963ff8ecd60562be",
"s3transfer-0.6.2-py3-none-any.whl": "11074ffe5b076fb3d7570d90448e7daabf3faa05d29f38132b04f6352299d72a",
"sagemaker-2.182.0-py2.py3-none-any.whl": "a2c15e882188ab4817db2a1761315c2a4f88062ded46a01034c1e53e8dd9e3ff",
"schema-0.7.5-py2.py3-none-any.whl": "7bdc0e92742022ca7270178fc8a2914f5dba5aeb769b037ca67deb461af106e3",
"six-1.16.0-py2.py3-none-any.whl": "3e1c439c88d2e7681372427bab751b3fc99969891e95a714fed9604bf7710213",
"smdebug_rulesconfig-1.0.1-py2.py3-none-any.whl": "67baf8ca0032bf2a09d4008103fec198d870360cdfc0febeb5d31dc480ce2eb1",
"smmap-5.0.0-py3-none-any.whl": "5fcddf5ee09f054ef4f8f6d903cf356d3bb93b3b1dec599f2eac198bec9ed1cb",
"sniffio-1.3.0-py3-none-any.whl": "feffd920899e99d56efbafd1469bc06ccab4337c224960b4ca43f5c937f56a6a",
"tblib-1.7.0-py2.py3-none-any.whl": "fde3148d690c9d474ef027b654ec90562a4fcdd20813a2d8d6f22fbe671879c8",
"text_unidecode-1.3-py2.py3-none-any.whl": "b927a485a7c5ea3c959180514bb6c1a43d44e949292bdbe9865e37fdaed35c02",
"typer-0.9.0-py3-none-any.whl": "d769c5e0cf70922639e8fcbf546959f9a4ab5d914d716ce117b14175968b546c",
"typing_extensions-4.7.1-py3-none-any.whl": "5e6df9210d60789205e617f60bb181074200092ebed2796a63358a9c9f3f1c75",
"urllib3-1.26.16-py2.py3-none-any.whl": "55ed1adea278529a458f440b5ed6ce3b7be6dac8041ee06ba2c06e83821a33d9",
"watchfiles-0.20.0-cp37-abi3-macosx_11_0_arm64.whl": "d44879bf8e2c3294cb2dd1f15dbf1982c89477764119a724f75d934f937bafc5",
"zipp-3.16.2-py3-none-any.whl": "f4d6d3db4feedf71e8e6fbdd30c0f51c59a63902f104c9f2fdf5d757cbada595"
},
"emit_warnings": false,
"entry_point": "cli.main",
"ignore_errors": false,
"includes_tools": false,
"inherit_path": "false",
"inject_args": [],
"inject_env": {},
"interpreter_constraints": [
"CPython==3.8.*"
],
"pex_hash": "51625a6fbd01b68370a16c38cd520f842deca7a0",
"pex_path": "",
"pex_paths": [],
"requirements": [
"GitPython>=3.0.0",
"PyYAML>=5.4.1",
"awswrangler",
"cookiecutter",
"databricks-sdk",
"pandas<2.0,>=1.4.0",
"python-slugify",
"rich",
"sagemaker",
"typer<1.0.0,>=0.3.2",
"watchfiles"
],
"strip_pex_env": true,
"venv": false,
"venv_bin_path": "false",
"venv_copies": false,
"venv_hermetic_scripts": true,
"venv_site_packages_copies": false
}
billowy-tiger-59247
09/05/2023, 6:13 PMpex*
packages on the path
pex.version
pex
pex.typing
pex.common
pex.pex_warnings
pex.enum
pex.inherit_path
pex.compatibility
pex.orderedset
pex.venv
pex.venv.bin_path
pex.variables
pex.tracer
pex.vendor
pex.vendor._vendored
pex.vendor._vendored.attrs
pex.vendor._vendored.attrs.attr._compat
pex.vendor._vendored.attrs.attr._config
pex.vendor._vendored.attrs.attr.exceptions
pex.vendor._vendored.attrs.attr.setters
pex.vendor._vendored.attrs.attr._make
pex.vendor._vendored.attrs.attr.converters
pex.vendor._vendored.attrs.attr.filters
pex.vendor._vendored.attrs.attr.validators
pex.vendor._vendored.attrs.attr._cmp
pex.vendor._vendored.attrs.attr._funcs
pex.vendor._vendored.attrs.attr._version_info
pex.vendor._vendored.attrs.attr._next_gen
pex.vendor._vendored.attrs.attr
enough-analyst-54434
09/05/2023, 6:14 PMenough-analyst-54434
09/05/2023, 6:17 PM$ cat requirements.txt
GitPython>=3.0.0
PyYAML>=5.4.1
awswrangler
cookiecutter
databricks-sdk
pandas<2.0,>=1.4.0
python-slugify
rich
sagemaker
typer<1.0.0,>=0.3.2
watchfiles
$ cat src/cli/main.py
import sys
from sagemaker.s3 import S3Uploader
if __name__ == "__main__":
print("\n".join(mod for mod in sys.modules if mod.startswith("pex")))
$ pex --python python3.8 -r requirements.txt -Dsrc -e cli.main -o example.pex
$ ./example.pex
pex.version
pex
billowy-tiger-59247
09/05/2023, 6:25 PMenough-analyst-54434
09/05/2023, 6:27 PMenough-analyst-54434
09/05/2023, 6:30 PMenough-analyst-54434
09/05/2023, 6:38 PM$ pex --python python3.8 pex==2.1.139 -cpex -- --python python3.8 -r requirements.txt -Dsrc -e cli.main -o example.pex
$ ./example.pex
pex.version
pex
That gets us on the same Pex version.billowy-tiger-59247
09/05/2023, 7:27 PMbillowy-tiger-59247
09/05/2023, 7:28 PMexecution_mode=venv
enough-analyst-54434
09/05/2023, 8:09 PM$ pex --python python3.8 pex==2.1.139 -cpex -- --python python3.8 -r requirements.txt --lock default_lock.txt -Dsrc -e cli.main -o example.pex
$ ./example.pex
/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/.bootstrap/pex/environment.py:673: PEXWarning: The `pkg_resources` package was loaded from a pex vendored version when declaring namespace packages defined by:
1. protobuf==3.20.3 namespace packages:
google
These distributions should fix their `install_requires` to include `setuptools`
pex_warnings.warn(
Traceback (most recent call last):
File "/home/jsirois/.pyenv/versions/3.8.18/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/jsirois/.pyenv/versions/3.8.18/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/__main__.py", line 108, in <module>
bootstrap_pex(__entry_point__, execute=__execute__, venv_dir=__venv_dir__)
File "/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/.bootstrap/pex/pex_bootstrapper.py", line 618, in bootstrap_pex
pex.PEX(entry_point).execute()
File "/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/.bootstrap/pex/pex.py", line 560, in execute
sys.exit(self._wrap_coverage(self._wrap_profiling, self._execute))
File "/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/.bootstrap/pex/pex.py", line 467, in _wrap_coverage
return runner(*args)
File "/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/.bootstrap/pex/pex.py", line 498, in _wrap_profiling
return runner(*args)
File "/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/.bootstrap/pex/pex.py", line 603, in _execute
return self.execute_entry(
File "/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/.bootstrap/pex/pex.py", line 771, in execute_entry
return self.execute_module(entry_point.module)
File "/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/.bootstrap/pex/pex.py", line 779, in execute_module
runpy.run_module(module_name, run_name="__main__", alter_sys=True)
File "/home/jsirois/.pyenv/versions/3.8.18/lib/python3.8/runpy.py", line 207, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/home/jsirois/.pyenv/versions/3.8.18/lib/python3.8/runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/home/jsirois/.pyenv/versions/3.8.18/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/cli/main.py", line 3, in <module>
from sagemaker.s3 import S3Uploader
File "/home/jsirois/.pex/installed_wheels/9c644caf1caa8bad76c4c8d6a051fa37948726d637ce406eafdc2f33d40928c5/sagemaker-2.182.0-py2.py3-none-any.whl/sagemaker/__init__.py", line 18, in <module>
from sagemaker import estimator, parameter, tuner # noqa: F401
File "/home/jsirois/.pex/installed_wheels/9c644caf1caa8bad76c4c8d6a051fa37948726d637ce406eafdc2f33d40928c5/sagemaker-2.182.0-py2.py3-none-any.whl/sagemaker/estimator.py", line 30, in <module>
from sagemaker import git_utils, image_uris, vpc_utils, s3
File "/home/jsirois/.pex/installed_wheels/9c644caf1caa8bad76c4c8d6a051fa37948726d637ce406eafdc2f33d40928c5/sagemaker-2.182.0-py2.py3-none-any.whl/sagemaker/image_uris.py", line 23, in <module>
from sagemaker import utils
File "/home/jsirois/.pex/installed_wheels/9c644caf1caa8bad76c4c8d6a051fa37948726d637ce406eafdc2f33d40928c5/sagemaker-2.182.0-py2.py3-none-any.whl/sagemaker/utils.py", line 40, in <module>
from sagemaker.config import validate_sagemaker_config
File "/home/jsirois/.pex/installed_wheels/9c644caf1caa8bad76c4c8d6a051fa37948726d637ce406eafdc2f33d40928c5/sagemaker-2.182.0-py2.py3-none-any.whl/sagemaker/config/__init__.py", line 16, in <module>
from sagemaker.config.config import load_sagemaker_config, validate_sagemaker_config # noqa: F401
File "/home/jsirois/.pex/installed_wheels/9c644caf1caa8bad76c4c8d6a051fa37948726d637ce406eafdc2f33d40928c5/sagemaker-2.182.0-py2.py3-none-any.whl/sagemaker/config/config.py", line 26, in <module>
import jsonschema
File "/home/jsirois/.pex/installed_wheels/043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb/jsonschema-4.19.0-py3-none-any.whl/jsonschema/__init__.py", line 13, in <module>
from jsonschema._format import FormatChecker
File "/home/jsirois/.pex/installed_wheels/043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb/jsonschema-4.19.0-py3-none-any.whl/jsonschema/_format.py", line 11, in <module>
from jsonschema.exceptions import FormatError
File "/home/jsirois/.pex/installed_wheels/043dc26a3845ff09d20e4420d6012a9c91c9aa8999fa184e7efcfeccb41e32cb/jsonschema-4.19.0-py3-none-any.whl/jsonschema/exceptions.py", line 14, in <module>
from attrs import define
File "/home/jsirois/.pex/installed_wheels/1f28b4522cdc2fb4256ac1a020c78acf9cba2c6b461ccd2c126f3aa8e8335d04/attrs-23.1.0-py3-none-any.whl/attrs/__init__.py", line 3, in <module>
from attr import (
ImportError: cannot import name 'AttrsInstance' from 'pex.vendor._vendored.attrs.attr' (/home/jsirois/.pex/unzipped_pexes/830409e07a10ffa3289ab6c001769a72362c7d02/.bootstrap/pex/vendor/_vendored/attrs/attr/__init__.py)
And the warning printed at the top is the proximal cause I believe. I'll dig a bit more, file an issue and link it here. Thanks for the details @billowy-tiger-59247.enough-analyst-54434
09/05/2023, 8:13 PM$ pex --python python3.8 pex==2.1.139 -cpex -- --python python3.8 -r requirements.txt -Dsrc -e cli.main -o example.no-lock.pex
$ ./example.no-lock.pex
pex.version
pex
$ unzip -qc example.no-lock.pex PEX-INFO | jq -r '.distributions | keys[]' | grep protobuf
protobuf-4.24.2-cp37-abi3-manylinux2014_x86_64.whl
enough-analyst-54434
09/05/2023, 8:20 PMsetuptools
requirement in addition to your requirements in requiremets.txt. The result is both no warning and no failure:
$ pex --python python3.8 pex==2.1.139 -cpex -- --python python3.8 -r requirements.txt setuptools --lock default_lock.txt -Dsrc -e cli.main -o example.plus-setuptools.pex
$ ./example.plus-setuptools.pex
pex.version
pex
I'm not sure there will be anything I can do about this! If Pex is forced to supply setuptools the vendoring system can't be fully un-imported. The only fix I can imagine is a new flag to Pex that says fail instead of warn. That would force you to fix the 3rdparty library problem by adding your own top-level setuptools requirement like I just did.enough-analyst-54434
09/05/2023, 8:23 PMpkg_resources
from setuptools is now gone in modern setuptools since the modern Python stdlib provides replacements for its functionality in importlib.*
code in addition to PEP-420 implicit namespace packages taking away the need for `pkg_resources.declare_namespace(...)`: https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#pkg-resources-style-namespace-packagesbillowy-tiger-59247
09/06/2023, 8:55 AMattr
import issue. In my understanding, protobuf requires pkg_resources
from setuptools
but doesn’t declare that as a requirement, so we end up importing that from a pex vendored setuptools instead. Does this import from vendored setuptools
have a side effect of including other vendored packages in the sys.path and then we end up with the attr
issue?enough-analyst-54434
09/06/2023, 9:02 AMattr
enough-analyst-54434
09/06/2023, 9:04 AM