We're getting an error in pants 2.18.0 with buildi...
# general
h
We're getting an error in pants 2.18.0 with building pex binaries. We're working on upgrading our OS from Ubuntu 20.04 and were hoping that the hermetic python offering through
pyenv
would simplify this by letting us upgrade the OS and not worry about having the proper interpreters on system path. I took a look through here, but I wasn't finding anything as an obvious stand out.
Error details
Copy code
$ pants package <path/to/pex>
17:45:24.97 [INFO] Completed: Building local_dists.pex
17:45:24.98 [ERROR] 1 Exception encountered:

Engine traceback:
  in `package` goal

ProcessExecutionFailure: Process 'Building local_dists.pex' failed with exit code 102.
stdout:

stderr:
Could not find a compatible interpreter.

Examined the following interpreters:
1.) /usr/bin/python3.11 CPython==3.11.6

No interpreter compatible with the requested constraints was found:

  Version matches CPython<3.9,>=3.8



Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
I would expect this error when it came time to run the pex but not at build time.
h
Well, Pants is running various pexes at build time...
Are you setting https://www.pantsbuild.org/docs/reference-python-bootstrap#search_path in a way that would prevent it from finding the pyenv interpreters?
h
I don’t believe we’re setting it at all
We’re using the launcher binary as well so it should have its own interpreter bundled by default, right?
h
Yes, but that is just for running Pants rules. Any tools Pants runs are invoked on interpreters found via that search path.
So that is the option to start playing with to see if you can manually coerce it to find the interpreters you want, and then see why that isn't happening by default.
h
A little confused on that? Should I try to get it to know about the pyenv provided interpreter?
h
It should by default (due to the
<PYENV>
entry) so start by checking the value of that option, seeing what you'd expect it to find based on that value, and modify the value until the right thing happens...
h
Okay, that’s makes sense to me. I’ll make sure to report back if we find any interesting behavior.
Been a long time here, but just as an update here, I had to explicitly update
python-bootstrap
in
pants.toml
like so
Copy code
[python-bootstrap]
search_path = ["<PYENV>"]
Then it works
Otherwise, pex building just fails on the first look in the system interpreter
This is a better change anyway since I don't want pants to use the system interpreter here
I'll open a bug ticket tomorrow for this