-
-
Notifications
You must be signed in to change notification settings - Fork 644
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
Binary location and interpreter selection issues #10855
Comments
Posted a fix for the first issue here: #10858. It should be sufficient to allow someone to work around the second issue by setting:
I might have misdiagnosed the second issue though: So to fix the second portion, we'd either need to make PEX resistant to this type of interpreter issue, or have pants take over more of the interpreter discovery/selection process. |
…0858) ### Problem The first error in #10855 is that when we search a search path which does not include `bash`, lookups fail silently because the discovery script fails to start. The usecase described on #9760 (setting `interpreter_search_path=["<PYENV>"]`) is one example where `bash` will not be present. ### Solution Recurse to locate an absolute path for `bash` before using `bash`. Additionally, change the "discovery" portion of `BinaryPaths` from `FallibleProcessResult` to `ProcessResult` to fail more quickly in cases where discovery errors, as opposed to succeeding with an empty result. ### Result The added test passes, and the usecase from #9760 works on my machine. [ci skip-rust] [ci skip-build-wheels]
Does this seem like an issue that affects Pex usage in general? Or is it specifically because of some weirdness around how pants invokes it here? |
Unclear... it's possible that Pants is explicitly passing an interpreter that PEX would not otherwise use. But it's also possible that PEX would fail in this user's environment as well. Can follow up with the user to ask them to try using PEX directly I suppose, but will hold off on doing that unless it turns out that the stack is not sufficient to fix the issue. |
I don't think this is possible. We use Pex to do the interpreter selection still: pants/src/python/pants/backend/python/util_rules/pex.py Lines 395 to 440 in 5f46286
|
Yeah, this has to be a bug in the interpreter cache somehow, I'm just not seeing it yet. OSX does something very weird here and I'm floundering a bit not having the OS in hand to repro / debug with. I'll give this one more hard throw logic out the window code scan a bit later. |
Since we use an UncacheableProcess to discover interpreters subject to interpreter constraints there is no need to mark the Process fallible. If there is something correctable on the filesystem, that can be corrected and pantsd re-started. |
Alright, I've found an OSX-only mechanism to trip up Pex via this Python ecosystem bug https://bugs.python.org/issue22490#msg283859 which we are vulnerable to. More here: python/cpython#9516 Re-opened an old unreproducible Pex issue that was probably dues to this same issue: pex-tool/pex#1009 I'll implement the fix over there. |
I'll close this upon upgrade to Pex 2.1.17 pex-tool/pex#1013. |
This pulls in a fix for interpreter selection under macOS framework Python builds. Fixes #pantsbuild#10855 [ci skip-rust] [ci skip-build-wheels]
This pulls in a fix for interpreter selection under macOS framework Python builds. Fixes ##10855
Two issues:
the- fixed in Locate bash before using it to locate BinaryPaths for other tools #10858Find binary
process that is used to locate a bootstrap interpreter limits the PATH to the search path for the tool that it is looking for. For search paths which do not includebash
(which will happen in the case described on Harden PATH setting in pex runs #9760), bash will not be found, causing the script to fail withenv: bash: No such file or directory
Find interpreter for constraints
process that is used to test interpreters is not marked fallibleFallibleProcessResult
, and so poisoned interpreters can kill it rather than just causing the poisoned interpreters to be skipped (full error).The text was updated successfully, but these errors were encountered: