curved-television-6568
05/19/2023, 11:51 AMpants.engine.target.InvalidFieldException: The target testprojects/src/python/native:main has the `interpreter_constraints` ('==3.9.*',), which are not a subset of the `interpreter_constraints` of some of its dependencies:
* ('==3.7.*',): testprojects/src/python/native/main.py:main_lib
* ('==3.7.*',): testprojects/src/python/native:dist
To fix this, you should likely adjust testprojects/src/python/native:main's `interpreter_constraints` to match the narrowest range in the above list.
from https://github.com/pantsbuild/pants/actions/runs/5018907494/jobs/9008981047?pr=17671#step:8:346
for https://github.com/pantsbuild/pants/pull/17671enough-analyst-54434
05/19/2023, 1:34 PMcurved-television-6568
05/19/2023, 1:34 PMcurved-television-6568
05/19/2023, 1:35 PMcurved-television-6568
05/19/2023, 1:36 PMenough-analyst-54434
05/19/2023, 1:37 PMcurved-television-6568
05/19/2023, 1:38 PMcurved-television-6568
05/19/2023, 3:37 PM3.9.*
, I get another error:
pants.engine.process.ProcessExecutionFailure: Process 'Find interpreter for constraints: CPython==3.7.*,==3.9.*' failed with exit code 102.
stdout:
stderr:
Could not find a compatible interpreter.
Examined the following interpreters:
1.) /Users/andreas.stenius/.pyenv/versions/3.9.13/bin/python3.9 CPython==3.9.13
2.) /Users/andreas.stenius/.pyenv/versions/3.11.1/bin/python3.11 CPython==3.11.1
3.) /Users/andreas.stenius/.pyenv/versions/3.7.13/bin/python3.7 CPython==3.7.13
4.) /Users/andreas.stenius/.pyenv/versions/3.8.13/bin/python3.8 CPython==3.8.13
5.) /opt/homebrew/Cellar/python@3.11/3.11.3/Frameworks/Python.framework/Versions/3.11/bin/python3.11 CPython==3.11.3
6.) /opt/homebrew/Cellar/python@3.10/3.10.11/Frameworks/Python.framework/Versions/3.10/bin/python3.10 CPython==3.10.11
7.) /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/bin/python3.9 CPython==3.9.6
No interpreter compatible with the requested constraints was found:
Version matches CPython==3.7.*,==3.9.*
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
Seems Pants tried to find an interpreter that would satisfy both 3.7 and 3.9 at the same time, which obviously is a futile endeavour.
diff --git a/testprojects/src/python/native/BUILD b/testprojects/src/python/native/BUILD
index a224fb460f..cca8a17be3 100644
--- a/testprojects/src/python/native/BUILD
+++ b/testprojects/src/python/native/BUILD
@@ -1,6 +1,12 @@
# Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
+__defaults__(
+ all=dict(
+ interpreter_constraints=["==3.9.*"],
+ )
+)
+
python_sources(name="lib", sources=["name.py", "setup.py"])
resources(name="impl", sources=["*.c"])
@@ -22,5 +28,4 @@ pex_binary(
name="main",
entry_point="main.py",
dependencies=[":dist", ":main_lib"],
- interpreter_constraints=["==3.9.*"],
)
Now running pants with:
❯ export PY=python3.7
❯ export PANTS_PYTHON_INTERPRETER_CONSTRAINTS="['==3.7.*']"
curved-television-6568
05/19/2023, 3:39 PMwitty-crayon-22786
05/19/2023, 4:51 PMcheck_visibility_rule_violations
->
resolve_dependencies
->
validate_python_dependencies
… is causing something to be checked that wasn’t before…? so possibly you exposed a bug in that validation?>witty-crayon-22786
05/19/2023, 4:52 PM./pants dependencies testprojects/src/python/native:main
on your branch?curved-television-6568
05/19/2023, 4:53 PM❯ pants dependencies testprojects/src/python/native:main
There is no pantsd metadata at /Users/andreas.stenius/src/github/kaos/pants/.pids/f2b095de0b47/pantsd.
12:52:48.05 [INFO] waiting for pantsd to start...
12:52:48.78 [INFO] pantsd started
12:52:50.32 [INFO] Starting: Resolving plugins: hdrhistogram, toolchain.pants.plugin==0.27.0
12:53:11.22 [INFO] Completed: Resolving plugins: hdrhistogram, toolchain.pants.plugin==0.27.0
12:53:17.26 [INFO] Initializing scheduler...
12:53:27.81 [INFO] Scheduler initialized.
testprojects/src/python/native/main.py:main_lib
testprojects/src/python/native:dist
witty-crayon-22786
05/19/2023, 4:54 PMcurved-television-6568
05/19/2023, 4:54 PMwitty-crayon-22786
05/19/2023, 4:54 PMwitty-crayon-22786
05/19/2023, 4:54 PM(I’ve started to observe those pantsd metadata msgs since yesterday, haven’t had time to dig into that yet)those are expected: the native client is used by default now on
main
curved-television-6568
05/19/2023, 4:55 PMwitty-crayon-22786
05/19/2023, 4:55 PMcurved-television-6568
05/19/2023, 4:58 PM❯ pants peek testprojects/src/python/native/:: | grep -A 2 interpreter
"interpreter_constraints": [
"==3.9.*"
],
--
"interpreter_constraints": [
"==3.9.*"
],
--
"interpreter_constraints": [
"==3.9.*"
],
--
"interpreter_constraints": [
"==3.9.*"
],
--
"interpreter_constraints": [
"==3.9.*"
],
witty-crayon-22786
05/19/2023, 4:58 PMcurved-television-6568
05/19/2023, 4:59 PMcurved-television-6568
05/19/2023, 4:59 PMwitty-crayon-22786
05/19/2023, 5:00 PM3.7
, right?curved-television-6568
05/19/2023, 5:00 PMcurved-television-6568
05/19/2023, 5:00 PM❯ pants python --help-advanced | grep interpreter -A 20
--python-interpreter-constraints="[<requirement>, <requirement>, ...]"
PANTS_PYTHON_INTERPRETER_CONSTRAINTS
interpreter_constraints
default: []
current value: [
"==3.7.*"
] (from env var PANTS_PYTHON_INTERPRETER_CONSTRAINTS)
overrode: [
">=3.7,<3.10"
] (from pants.toml)
curved-television-6568
05/19/2023, 5:01 PMPANTS_PYTHON_RESOLVES_TO_INTERPRETER_CONSTRAINTS
resolves_to_interpreter_constraints
default: {}
current value: {
"python-default": [
">=3.7,<3.10"
]
} (from pants.toml)
witty-crayon-22786
05/19/2023, 5:02 PM./pants dependencies testprojects/src/python/native:main
should be failing with those global ICs, because you have a 3.9
target depending on two 3.7
targets. so the fact that it didn’t before your PR is a bug =(curved-television-6568
05/19/2023, 5:03 PMcurved-television-6568
05/19/2023, 5:04 PMcurved-television-6568
05/19/2023, 5:09 PMlint
a python_sources
target with IC != default IC I hit this.curved-television-6568
05/19/2023, 5:16 PMpants dependencies
still doesn’t fail, only lint
curved-television-6568
05/19/2023, 5:20 PM❯ pants lint testprojects/src/python/native::
fails for me on main
using the 3.7 shard setup.curved-television-6568
05/19/2023, 5:21 PMmain
.