Skip to content

Fix poetry installation on macOS when Python from Xcode Command Line Tools - #186

Closed
caorantaoyao wants to merge 2 commits into
python-poetry:mainfrom
caorantaoyao:fix/issue-24-4f2795
Closed

Fix poetry installation on macOS when Python from Xcode Command Line Tools#186
caorantaoyao wants to merge 2 commits into
python-poetry:mainfrom
caorantaoyao:fix/issue-24-4f2795

Conversation

@caorantaoyao

Copy link
Copy Markdown

Root cause: On macOS, when Python 3.x is installed by the Xcode Command Line Tools, the base interpreter is a stub (e.g. /usr/bin/python3 -> /Library/Developer/CommandLineTools/usr/bin/python3). Creating a virtual environment with the stdlib venv module from this stub produces a venv whose bin/python carries an unresolvable @executable_path/../Python3 loader reference. As a result, pip (and therefore the poetry install) fails with a dyld error: Library not loaded: @executable_path/../Python3.

Fix: When sys.platform == "darwin" and the interpreter path points into /Library/Developer/CommandLineTools, force the installer to use the existing virtualenv zipapp bootstrap path (--always-copy), which creates a self-contained virtual environment that is not affected by the broken stdlib venv layout.

Behavior: The new branch only triggers on macOS for the Command Line Tools stub interpreter. On all other platforms and Python installations the existing venv code path is unchanged.

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

@caorantaoyao is attempting to deploy a commit to the Poetry Team on Vercel.

A member of the Team first needs to authorize it.

@caorantaoyao

Copy link
Copy Markdown
Author

Duplicate of #187. Closing in favor of the updated PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant