-
-
Notifications
You must be signed in to change notification settings - Fork 649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python provider not used for pants package
of pex_binary
target
#21048
Comments
This fails for building a |
pants package
pants package
of pex_binary
target
This reproduces with Reproducer: cd $(mktemp -d)
# NB. adjust the 3.10.8 to be an interpreter that's not available on your system
cat > pants.toml <<EOF
[GLOBAL]
pants_version = "2.24.0a0"
backend_packages = [
"pants.backend.python",
"pants.backend.python.providers.experimental.python_build_standalone",
]
[python]
interpreter_constraints = ["CPython==3.10.8"]
EOF
cat > BUILD <<EOF
python_sources(name="s")
pex_binary(name="p", entry_point="./example.py")
EOF
echo "print('hi')" > example.py
# Okay: runs and prints `hi` just fine
pants run ./example.py
# BUG: cannot find interpreter
pants package :p |
|
In #21842 we have another reproducer with more exploration, which leads to two new observations:
|
I ran across this today when rebuilding our CI images, and I seemingly cannot make it work with the above workaround. Instead, it fails with the following error:
If I don't add the boostrap entry, only the second exists. Interestingly, pyenv is at least evaluated at some point before getting here; as I only saw this once I had added all the native libs needed to build CPython. I'm a bit confused why it also still lists the entry for |
I think after playing around with a few reproducing cases that we're simply not passing the pyenv Python paths to the Pex process at all. In my logs I can see the correct Python being selected to run the pex, but that path is nowhere in the build invocation. So when Pex tries to locate the compatible interpreter it barfs, because all it has is |
I'm a bit too unfamiliar with the Python backend but I think this PR does workaround the issue, following the reasoning above. #21948. But I don't think it's correct generally and probably runs afoul of other assumptions in the (quite convoluted) Pex/Python build flow. |
Describe the bug
When using
pants.backend.python.providers.experimental.pyenv
test, lint and check works fine, but package fails.Pants version
2.21.0
OS
Ubuntu
Additional info
The text was updated successfully, but these errors were encountered: