Is there a way to debug "why does Pants bootstrap ...
# general
s
Is there a way to debug "why does Pants bootstrap itself with a given interpreter"? • I have a system minimal py39 • I have a pyenv, first thing on $PATH, of py37 • if I run
python3
I get the pyenv py37 I have a $PATH of
Copy code
/home/wimax/.pyenv/shims:/home/wimax/.config/nvm/versions/node/v17.3.0/bin:/home/wimax/.cargo/bin:/home/wimax/.pyenv/bin:/home/wimax/.pyenv/bin:/home/wimax/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/wimax/.pulumi/bin
but if I do
./pants goals
it selects
Copy code
./pants goals
Bootstrapping Pants using /usr/bin/python3.9
w
this is all in the
pants
script itself
s
Ah. I'll take a look then
h
Hello! You can add
set -x
to the top of the ./pants bash script to see what each line is doing
s
(i assume that's xtrace?)
yep cool
ok thanks folks
Ah, interesting, it intentionally prioritizes any pythons it finds in descending order. I guess that makes sense. Thanks! Setting PYTHON=python3.7 did the trick
❤️ 1
r
One thing that helps is setting
Copy code
interpreter_constraints
https://www.pantsbuild.org/docs/python-interpreter-compatibility
h
It's a little confusing - that option changes which python interpreter pants uses to run your own code. The bash script and PYTHON env var control meanwhile which interpreter is used to run Pants itself. So the option won't help here
w
@refined-addition-53644: unfortunately, that doesn’t work for the bootstrap of pants itself: the
interpreter_constraints
option only controls which pythons pants uses to run your own code
💯 1
r
Yeah true! didn't realize it's about bootstrapping pants. We were running into this kind of python version issue today while trying to run our own code.
👍 1