Fix installation failure when Python is from macOS Command Line Tools - #187
Draft
caorantaoyao wants to merge 2 commits into
Draft
Fix installation failure when Python is from macOS Command Line Tools#187caorantaoyao wants to merge 2 commits into
caorantaoyao wants to merge 2 commits into
Conversation
|
@caorantaoyao is attempting to deploy a commit to the Poetry Team on Vercel. A member of the Team first needs to authorize it. |
for more information, see https://pre-commit.ci
This was referenced Aug 10, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When python3 is provided by the macOS Xcode Command Line Tools (e.g. /usr/bin/python3 -> /Library/Developer/CommandLineTools/usr/bin/python3), the cpython venv it creates carries an unresolvable @executable_path/../Python3 loader reference in bin/python, so pip fails with a dyld error and the poetry install aborts.
This change makes VirtualEnvironment.make() detect that situation (sys.platform == "darwin" and /Library/Developer/CommandLineTools in sys.executable) and route through the existing robust virtualenv.pyz bootstrap (--clear --always-copy) instead of the broken cpython venv path. The branch is additive and guarded to darwin + CommandLineTools only; the normal cpython venv path is unchanged.
A new test (tests/test_installer.py) mocks the darwin/CLT interpreter and asserts the --always-copy bootstrap is used.