Skip to content
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

Installation breaks when Homebrew upgrades Python due to dangling dylib reference #34

Closed
2 tasks done
cjolowicz opened this issue Sep 4, 2022 · 1 comment
Closed
2 tasks done
Labels
duplicate This issue or pull request already exists

Comments

@cjolowicz
Copy link

cjolowicz commented Sep 4, 2022

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.

--

  • OS version and name: macOS 12.5.1 (Intel)
  • Poetry version: 1.2.0
  • Python version: 3.10.6_2 (Homebrew)

The Poetry installation breaks when Homebrew upgrades Python to a new maintenance release or to a new downstream release (e.g. 3.10.6_1 to 3.10.6_2). The error message is the following:

dyld[8108]: Library not loaded: '/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/Python'
  Referenced from: '/Users/user/Library/Application Support/pypoetry/venv/bin/python'
  Reason: tried: '/usr/local/Cellar/python@3.10/3.10.6_1/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.10/Python' (no such file)

You should be able to reproduce this by:

  1. Install an older version of the main Homebrew Python (python@3), e.g. 3.10.6_1
  2. Install Poetry using the default method
  3. Upgrade the main Homebrew Python
  4. Invoke Poetry

The problem appears to be that the installer creates the virtual environment with copies instead of symlinks. This is a good default for Windows, but not for macOS. On macOS, the copied interpreter binary references the Python dynamic library using a path including the full version number. When Homebrew upgrades Python, this path disappears. By contrast, virtual environments created with the default strategy use a symbolic link that remains stable for all releases of a Python feature version (major.minor). Upgrading Python to a maintenance release seamlessly and implicitly upgrades any associated virtual environments.

The problem is here:

            builder = venv.EnvBuilder(clear=True, with_pip=True, symlinks=False)

I suggest omitting the symlink argument and using the platform default instead, which is False on Windows and True elsewhere.

@cjolowicz cjolowicz changed the title Installation breaks when Homebrew upgrades Python due to dangling dynlib reference Installation breaks when Homebrew upgrades Python due to dangling dylib reference Sep 4, 2022
@neersighted neersighted added the duplicate This issue or pull request already exists label Sep 4, 2022
@neersighted
Copy link
Member

neersighted commented Sep 4, 2022

Duplicate #24

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants