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

cold-breakfast-93567

06/01/2021, 8:30 PM
Any advise regarding how could I figure out how and why
pythhon39
is being picked up even after being super explicit about the version of the python repl?
e

enough-analyst-54434

06/01/2021, 8:31 PM
Best to start with full output including the exact command run. Basically, please report
./pants -ldebug ...
plus all the resulting output in total.
👍 1
That will at least narrow down which phase of execution is hitting this error - several could.
I will note pyenv shims are involved. Pants 1.x and the Pex versions it used were both not pyenv shim smart and pyenv shims could cause havoc.
So you might temporarily try removing pyenv shims from your PATH, ./pants clean-all, ./pants ... And see if that still errors or fixes.
🎉 1
👍 1
If your only useful pythons are pyenv versions, then add ~/.pyenv/versions/<this one>/bin to your PATH instead - again - temporarily for the purposes of this test.
c

cold-breakfast-93567

06/01/2021, 8:36 PM
Thank you for the awesome suggestions! Let me try them.
-ldebug
provides a bunch of super useful output, thank you for the suggestion, didn't know it (I'm a
pants
newbie)
Yay,
removing pyenv shims from your PATH, ./pants clean-all, ./pants ...
helped, thank you for the suggestion! I was wondering if there is any CLI flag that I can use to write in stone the interpreter path? (i.e. to achieve the same result without modifying PATH)
Thank you for the help!
e

enough-analyst-54434

06/01/2021, 10:36 PM
Maybe
--python-setup-interpreter-search-paths="['<PYENV>', '<PATH>']"
- and that's a literal string including the
<PYENV>
and `<PATH>`bits. That bit of pyenv special casing adds all the
~/.pyenv/vesions/*/bin
to your interpreter search path. By placing that ahead of
<PATH>
, that will find a valid pyenv 2.7 interpreter - if you have on - before looking for one on the
<PATH>
and seeing shims.
👍 1
Docs here: https://v1.pantsbuild.org/options_reference.html Search for --python-setup-interpreter-search-paths
👍 1