Hi, I'm trying to build a lambda zip from a target...
# general
s
Hi, I'm trying to build a lambda zip from a target, but I'm getting the following exception:
Copy code
Failed to resolve for platform linux_x86_64-cp-38-cp38. Resolve requires evaluation of unknown environment marker: 'python_full_version' does not exist in evaluation environment.
I'm using Poetry to manage dependencies. I generated the
constraints.txt
file running
poetry export --dev --without-hashes -o constraints.txt
, and it contains lines like this:
Copy code
isort==5.10.1; python_full_version >= "3.6.1" and python_version < "4.0"
which makes me believe that's related to the error. Could that be the case? Appreciate your help, thank you!
h
Hello 🙂 I haven't looked closely at the Pex issue, but I think this relates to https://github.com/pantsbuild/pex/pull/1596
s
yes! found that while googling, but I'm not sure how to fix the issue though
e
@swift-dawn-80732 what is your setting for the following?
Copy code
[tool.poetry.dependencies]
python
I.E.: Is it you with the picky >= 3.6.1 requirement or is that coming from some transitive dependency source?
s
@enough-analyst-54434
Copy code
[tool.poetry.dependencies]
python = "^3.9"
boto3 = "1.20.52"
Pillow = "9.0.1"

[tool.poetry.dev-dependencies]
black = "22.1.0"
docformatter = "1.4"
flake8 = "4.0.1"
isort = "5.10.1"
moto = "3.0.3"
mypy = "0.931"
pytest = "7.0.0"
pytest-mock = "3.7.0"
e
Ok. Well, there is nothing in your control here. Eric is right and https://github.com/pantsbuild/pex/pull/1596 has a discussion of the issue. But, simply, when specifying a platform string like
linux_x86_64-cp-38-cp38
there is not enough information to guess the 3rd Python version part which is what
python_full_version
requires; so the failure is correct. It's saying, sorry - won't guess.
In order to deal with this, Pex would need to allow you to manually specify some or all platform markers of the foreign platform. All these: https://www.python.org/dev/peps/pep-0508/#environment-markers Pex only fills in the ones it can derive from the
linux_x86_64-cp-38-cp38
platform string.
This is frustrating since
isort==5.10.1; python_full_version >= "3.6.1" and python_version < "4.0"
looks like a fairly crazy requirement. That says, grab me isort for Python 3.6.1 but not for Python 3.6.0 which begs th question of why? What do you do on Python 3.6.0 or what is so broken with Python 3.6.0?
This has come up 2x so it seems like a real issue in the wild. I'll file a Pex issue to come up with some way to both emit all environment markers for an interpreter and then use those on another machine. That's all I can think of here.
s
right, but the platform string is generated here: https://github.com/pantsbuild/pants/blob/main/src/python/pants/backend/awslambda/python/rules.py#L80 and it doesn't use the patch version
e
But, stepping back 1st, do you actually intend to use platform here? Is that to build a Linux PEX on a Mac?
@swift-dawn-80732 yes, that's right, platform strings, just like wheel tags, don't have a spot to put the patch version. This is by design so far.
The issue appears to be in how
poetry export
works. It generates those ~crazy requirement env markers and is the common thread in the 2 issue reports.
âž• 1
s
good point, I'll open an issue in the pex repo then
thanks for your help!
e
That's the issue. No need to open one, but thanks for being willing to.
s
nice! thanks a lot!