Hey, Benjy asked me to post this for y’all to see...
# general
m
Hey, Benjy asked me to post this for y’all to see, so here I go: Amongst team members having problems to get going with Pants, one saw some very confusing paths that suggest a mash-up between Python 2.7.0 and 3.9. This is the error they got:
Copy code
(devtools) Moon-Kang's-MacBook-Pro:devtools moon$ make lint
./pants lint typecheck ::
15:14:58.25 [INFO] Initializing scheduler...
15:14:58.53 [INFO] Scheduler initialized.
15:15:10.94 [ERROR] Exception caught: (pants.engine.internals.scheduler.ExecutionError)
  File "/Users/moon/.cache/pants/setup/bootstrap-Darwin-x86_64/2.7.0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 236, in _run_inner
    return self._perform_run(goals)
  File "/Users/moon/.cache/pants/setup/bootstrap-Darwin-x86_64/2.7.0_py39/lib/python3.9/site-packages/pants/bin/local_pants_runner.py", line 175, in _perform_run
    self._raise_on_error([t for _, t in throws])
  File "/Users/moon/.cache/pants/setup/bootstrap-Darwin-x86_64/2.7.0_py39/lib/python3.9/site-packages/pants/engine/internals/scheduler.py", line 506, in _raise_on_error
    raise ExecutionError(

Exception message: 1 Exception encountered:

  ProcessExecutionFailure: Process 'Find interpreter for constraints: CPython<4,>=3.6' failed with exit code 1.
This is a MacBook Pro running macOS 12.2.1. As far as Python is concerned, they have several installed, including 3.7, 3.8, 3.9, as far as I know mostly with pyenv. Robert
h
Is there anything below that error message? Pex should be saying what was inspected
w
and what does your repository set for the https://www.pantsbuild.org/docs/python-interpreter-compatibility#changing-the-interpreter-search-path … and would it include the interpreter you were expecting to be used?
👍 1
the 2.7.0 you’re seeing there is pants’ own version
1
e
Yeah. Almost good enough pattern matching, but the algorithm chopped a prefix
2.7.0_py39/lib/python3.9
m
@witty-crayon-22786, we currently do not have an interpreter search path set. So that’s definitely one thing we need to moving forward.
As to the 2.7.0 being the Pants version, that’s surprising to me because I upgraded to 2.8.0 a while ago. I’m checking when my colleague collected the trace.
w
yea, possibly. the post that @fresh-cat-90827 wrote on this recently will probably help there: https://blog.pantsbuild.org/choosing-a-python-interpreter-for-a-pants-project/
🙏 1
1
m
Thanks for the pointer. I’m looking forward to reading it because that sounds like just what we need. Before trying Pants I read the entire documentation (for once) and the thing is: I can’t remember even seeing the search path option. Maybe that should be highlighted early on?!
I just scanned the blog post and it suggests setting
interpreter_search_paths
in the
[python]
section. But the documentation page suggests setting
search_paths
in the
[python-bootstrap]
section. That’s pretty confusing. Which one is it and when did that change?
h
in 2.9,
[python].interpreter_search_paths
was deprecated in favor of
[python-bootstra].search_paths
. Both still work in 2.9, but the former was removed in 2.10