-
-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'UndefinedEnvironmentName: 'python_full_version' does not exist in evaluation environment' when building lambda with any 3rd party dev on arm64 macOS #15296
Comments
@huonw the issue here is the lockfile, which is generated by Poetry and exported to requirements.txt format: https://github.com/huonw/pants-awslambda-UndefinedEnvironmentName/blob/main/3rdparty/python/default.lock In the process of exporting the Poetry lockfile, Poetry adds the There are two ways to fix this:
To do the former, use Pants 2.11.0 and configure {
"allow_builds": true,
"allow_prereleases": false,
"allow_wheels": true,
"build_isolation": true,
"constraints": [],
"locked_resolves": [
{
"locked_requirements": [
{
"artifacts": [
{
"algorithm": "sha256",
"hash": "44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14",
"url": "https://files.pythonhosted.org/packages/ec/03/062e6444ce4baf1eac17a6a0ebfe36bb1ad05e1df0e20b110de59c278498/urllib3-1.26.9-py2.py3-none-any.whl"
},
{
"algorithm": "sha256",
"hash": "aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e",
"url": "https://files.pythonhosted.org/packages/1b/a5/4eab74853625505725cefdf168f48661b2cd04e7843ab836f3f63abf81da/urllib3-1.26.9.tar.gz"
}
],
"project_name": "urllib3",
"requires_dists": [
"PySocks!=1.5.7,<2.0,>=1.5.6; extra == \"socks\"",
"brotli>=1.0.9; ((os_name != \"nt\" or python_version >= \"3\") and platform_python_implementation == \"CPython\") and extra == \"brotli\"",
"brotlicffi>=0.8.0; ((os_name != \"nt\" or python_version >= \"3\") and platform_python_implementation != \"CPython\") and extra == \"brotli\"",
"brotlipy>=0.6.0; (os_name == \"nt\" and python_version < \"3\") and extra == \"brotli\"",
"certifi; extra == \"secure\"",
"cryptography>=1.3.4; extra == \"secure\"",
"idna>=2.0.0; extra == \"secure\"",
"ipaddress; python_version == \"2.7\" and extra == \"secure\"",
"pyOpenSSL>=0.14; extra == \"secure\""
],
"requires_python": "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,<4,>=2.7",
"version": "1.26.9"
}
],
"platform_tag": [
"cp310",
"cp310",
"manylinux_2_35_x86_64"
]
}
],
"path_mappings": {},
"pex_version": "2.1.84",
"prefer_older_binary": false,
"requirements": [
"urllib3==1.26.9"
],
"requires_python": [],
"resolver_version": "pip-2020-resolver",
"style": "universal",
"transitive": true,
"use_pep517": null
} An example of the latter is here: #15239 (comment). You should be able to follow that to the letter but you do not need two platform files as used there, just the linux lambda platform file is enough if you only intend to run the lambda out in AWS. |
Ah I see. Thank you for the pointers @jsirois, they should unblock us from using Pants. 👍 The new pex lockfile generation looks nifty, but I think we'll be stuck using poetry to generate our lockfiles:
Given this, we'll be using |
I think this likely won't cause problems in practice. As to lock file updates, Pex does support a |
Thanks for the tip. I had a chance to try the Just LinuxI ran I then adjusted the Running
(I note that the The Mac and LinuxFrom #15239 (comment), it sounds like adding something for the build platform may help, but that adjustment didn't seem to (diff: huonw/pants-awslambda-UndefinedEnvironmentName@347bc22) This gives the same error as before. Any tips for what I'm doing wrong here? Thanks for tolerating my basic questions. |
You must remove the runtime parameter when adding complete_platforms. Did you try that? |
My apologies for the terse responses. At a keyboard now, so to clarify a few things: Although both To expand on the:
Pex really isn't at play here. The complete platform data is the actual data used to perform a dependency resolve by PEP standards by Pip, Poetry, etc. Most of the data is not needed for most dependencies. On the environment marker side, a very large percentage of dependencies only use the And thanks very much for your example repo. That is, of course, gold and really helps root things out very quickly. |
No worries at all, thank you for taking the time to work through this.
Ah, I didn't try that. Removing the It seems like the docs don't seem mention any interaction between
Ah I see; thanks for the explanation. Looking through our lock file, all the uses of
😄 |
Can we close this? |
I've got it working in our code (thanks again for the tech support), so feel free to close if you think that's satisfactory. However, looking over https://www.pantsbuild.org/docs/awslambda-python, I suspect I'd personally still hit the same issues if I was starting again, with 2.13. Maybe:
I would offer PRs for both of these, but I'm not familiar enough with the constraints (or pants/pex) to validate if they make sense or phrase the general rules 😄 |
Describe the bug
I'm trying to build a
python_awslambda
on an arm64 macOS device. As soon as I add any 3rd party dependency (with prebuilt wheels that are highly compatible: https://pypi.org/project/urllib3/1.26.9/#files) in a minimal project https://github.com/huonw/pants-awslambda-UndefinedEnvironmentName, I get an error aboutpython_full_version
:NB. the build works if I comment out the
import urllib3
fromsrc/lambda-package/lambda.py
Pants version
The linked project reproduces this for me on all of (with just minor adjustments to the
pants.toml
):This seems to be related to #14995, but the fix for that has apparently landed in all but 2.10.0.
OS
macOS
Additional info
The text was updated successfully, but these errors were encountered: