handsome-sunset-98068
09/16/2022, 8:18 AMFailed to resolve all requirements for abbreviated platform cp39-cp39-linux_x86_64 from 3rdparty/python/default.lock:
Configured with:
build: False
use_wheel: True
Dependency on img2pdf not satisfied, 1 incompatible candidate found:
1.) img2pdf 0.4.4 (via: img2pdf==0.4.4) does not have any compatible artifacts:
<https://files.pythonhosted.org/packages/95/b5/f933f482a811fb9a7b3707f60e28f2925fed84726e5a6283ba07fdd54f49/img2pdf-0.4.4.tar.gz>
handsome-sunset-98068
09/16/2022, 8:36 AMpython_sources()
python_awslambda(
name="img2pdf-lambda",
runtime="python3.9",
handler="./handler.py:lambda_handler",
)
handler.py
import img2pdf
def lambda_handler(event, context):
print('hello world')
refined-addition-53644
09/16/2022, 9:17 AM```Configured with:
build: False
use_wheel: True```To me it seems like since pants is not allowing the build and the wheels don’t exist, it fails But I didn’t know you can configure this. EDIT: This is from pants logs
handsome-sunset-98068
09/16/2022, 9:19 AMrefined-addition-53644
09/16/2022, 9:22 AMhandsome-sunset-98068
09/16/2022, 9:40 AM[GLOBAL]
pants_version = "2.12.0"
backend_packages.add = [
'pants.backend.python',
"pants.backend.python.mixed_interpreter_constraints",
"pants.backend.awslambda.python",
'pants.backend.python.lint.docformatter',
'pants.backend.python.lint.black',
'pants.backend.python.lint.flake8',
'pants.backend.python.lint.isort',
'pants.backend.python.typecheck.mypy',
]
[anonymous-telemetry]
enabled = false
[source]
root_patterns = ["/", "projects"]
[python]
interpreter_constraints = ["CPython>=3.9"]
enable_resolves = true
lockfile_generator = "pex"
[python-infer]
string_imports = true
[pytest]
lockfile = "3rdparty/python/pytest.txt"
version = "pytest>=7.1.2,<7.2"
extra_requirements.add = [
"pytest-django>=4.5.2,<5",
]
execution_slot_var = "PANTS_EXECUTION_SLOT" # (controlling (test) parallelism) If a non-empty string, the process execution slot id (an integer) will be exposed to tests under this environment variable name.
args = ["-s"]
enough-analyst-54434
09/16/2022, 6:54 PMConfigured with:
build: False
use_wheel: True
That's really just Pex's reaction to pants passing --platform linux_x86_64-cp-39-cp39
which is what it does to tell Pex - "Hey, I know we're on Mac, but try to build a venv that works on Linux". Since we're on Mac, we cannot build sdists into Linux wheels without cross-building. Pex does not support cross-building and so it only allows pre-built wheels. The resolve fails since there is no pre-built wheel for img2pdf
. You need to build one for Linux and then make it available in a --find-links
repo for Pex to find. When using Pants you configure this with `[python-repos] repos = ...`: https://www.pantsbuild.org/docs/reference-python-repos#reposenough-analyst-54434
09/16/2022, 6:55 PMhandsome-sunset-98068
09/19/2022, 5:05 AM