https://pantsbuild.org/ logo
#general
Title
# general
a

ancient-france-42909

11/08/2022, 6:46 PM
Trying to begin the process of upgrading our Python version and I’ve added
interpreter_constraints=["CPython~=3.7.4", "CPython~=3.10.8"]
to my test utils (and a parametrise for those two versions to the tests:
interpreter_constraints=parametrize(py3_7=["CPython~=3.7.4"], py3_10=["CPython~=3.10.8"])
) and I get this error
Copy code
pants.engine.process.ProcessExecutionFailure: Process 'Find interpreter for constraints: CPython~=3.10.8,~=3.7.4' failed with exit code 102.
stdout:

stderr:
Could not find a compatible interpreter.

Examined the following interpreters:
1.)   /Users/user/.pyenv/versions/3.7.4/bin/python3.7 CPython==3.7.4
2.) /Users/user/.pyenv/versions/3.10.0/bin/python3.10 CPython==3.10.0
3.) /Users/user/.pyenv/versions/3.10.3/bin/python3.10 CPython==3.10.3
4.) /Users/user/.pyenv/versions/3.10.6/bin/python3.10 CPython==3.10.6
5.) /Users/user/.pyenv/versions/3.10.8/bin/python3.10 CPython==3.10.8
6.)  /Users/user/.pyenv/versions/3.8.13/bin/python3.8 CPython==3.8.13
7.)  /Users/user/.pyenv/versions/3.9.13/bin/python3.9 CPython==3.9.13
8.)   /Users/user/.pyenv/versions/3.9.5/bin/python3.9 CPython==3.9.5

No interpreter compatible with the requested constraints was found:

  Version matches CPython~=3.10.8,~=3.7.4
Is this not how I’m supposed to do it, or is there something else wrong here?
e

enough-analyst-54434

11/08/2022, 6:49 PM
That comma at the bottom in the Pex output means AND, which is impossible to satisfy. Your ICs up above in pants land show a two element list which means OR. So I think Pants is turning the OR into an AND by the time it calls Pex.
If so, that's some form of bug. You can check how Pants calls Pex by adding
-ldebug
to a rerun of Pants. Look for
--interpreter-constraint
arguments, should be two, looks like Pants passes one with an embedded comma.
a

ancient-france-42909

11/08/2022, 6:53 PM
Copy code
20:53:33.08 [DEBUG] Canceled: Scheduling: Find interpreter for constraints: CPython~=3.10.8,~=3.7.4 OR CPython~=3.7.4
I wonder if it’s trying to run combine them. So, the py3_7 adds its constraint to both ORs.
e

enough-analyst-54434

11/08/2022, 6:55 PM
Perhaps, yeah.
a

ancient-france-42909

11/08/2022, 6:56 PM
Oh, heh. I changed the test_util constraint to 3.7.3, and now I get:
Copy code
20:55:34.78 [DEBUG] Completed: Find interpreter for constraints: CPython~=3.10.8,~=3.7.3,~=3.7.4 OR CPython~=3.10.8,~=3.7.4
(this is with
2.14.0
, btw)
e

enough-analyst-54434

11/08/2022, 6:57 PM
There may be a way to configure this "right" but you also may be bumping into a corner we're not handling.
a

ancient-france-42909

11/08/2022, 6:57 PM
Okay, but how am I supposed to do this?
e

enough-analyst-54434

11/08/2022, 6:58 PM
No clue.
a

ancient-france-42909

11/08/2022, 6:58 PM
I want to run the tests on both 3.7 and 3.10, the docs say “oh, use parametrise like this”, but then it complains that the test_util doesn’t work with 3.10
(From here)
e

enough-analyst-54434

11/08/2022, 6:59 PM
Usually folks have a continuous range. So this is where your case may be new for us. I'm really not sure. @hundreds-father-404 or @witty-crayon-22786 might know more about this case.
a

ancient-france-42909

11/08/2022, 7:01 PM
I guess I could do ~=3.7.4,<3.11, since the binaries will only have one version anyway
erm, >=3.7.4
Nope.
Copy code
21:02:59.88 [DEBUG] Completed: Find interpreter for constraints: CPython<3.11,>=3.7.4,~=3.10.8,~=3.7.4
I’m struggling to find a pattern, but it’s definitely doing unexpected things.
Oh, I think I know this one, actually
Hm, no, it’s not the global constraint applying to other dependencies
Oh, it is…
Okay, so I think that explains it. But it’s weird that the test_util gave me an error, but not this one
So, yeah, it was me being stupid, as always 🙂
h

happy-kitchen-89482

11/09/2022, 1:11 AM
Glad it’s working now!
8 Views