-
Notifications
You must be signed in to change notification settings - Fork 56
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
Poetry environment breaks when Homebrew upgrades Python on MacOS #71
Comments
Similar issue here. I ran into this previously when upgrading from 3.10.6 and from 3.10.7. It seems that the old binaries are referenced by |
same thing happened to me from 3.10.8 to 3.10.9, reinstall worked just fine. wondering why the binary needs to reference a specific python version. might install this with pipx instead if homebrew python gives me more trouble with the official installer. |
The source of this same issue for me was conflicting poetry installs. Changing the name of whatever came up from |
Running into the same issue. I used Python3 installed via Homebrew, and after a minor version update, Poetry was broken. Should we not use Homebrew to install Python? Would using pyenv solve this issue going forward? |
Same issue just hit me too, fixed with uninstall and reinstall: curl -sSL https://install.python-poetry.org | python3 - --uninstall
curl -sSL https://install.python-poetry.org | python3 |
I just ran into this again, after doing a brew update. The above uninstall/reinstall failed to fix it this time. New solution:
brew remove python
brew install pyenv
echo 'export PATH="$HOME/.pyenv/shims:$PATH"' >> ~/.profile
source ~/.profile
pyenv install 3.11.4
pyenv global 3.11.4
curl -sSL https://install.python-poetry.org | python3 - --uninstall
curl -sSL https://install.python-poetry.org | python3 - |
Ran into the same issue. Removing homebrew's python does not work for me, I have many dependent formulas. I also use I managed to successfully reinstall |
I don't think you need to uninstall the homebrew installed python. Install a separate python using pyenv, don't make it global, then use that python to install poetry: curl -sSL https://install.python-poetry.org | "$(pyenv root)/versions/3.11.4/bin/python" - |
I found a solution in issue #52. The current way to fix this is to change the Fix:
Stepsmkdir -p /tmp/poetry_installer/ ; cd /tmp/poetry_installer # This can be anywhere
curl -sSL https://install.python-poetry.org > poetry_installer.py
python3 ./poetry_installer.py --uninstall Change line 317 of poetry_installer.py (at the time of writing) from - builder = venv.EnvBuilder(clear=True, with_pip=True, symlinks=False)
+ builder = venv.EnvBuilder(clear=True, with_pip=True, symlinks=True) python3 ./poetry_installer.py Poetry should work again! |
Thanks social-anthrax -- that procedure worked! |
I'd be interested in seeing what would break if one set the symlinks to True on a standard install. If it doesn't break anything and doesn't change behaviour it could be worth having that as the standard option if it fixes MacOS installation |
Hit this today after a dyld[36086]: Library not loaded: @loader_path/../../../../Python.framework/Versions/3.11/Python
Referenced from: <16376C03-0DA9-3714-9207-5AF8D546EED4> /Users/nicolas.fantone/Library/Application Support/pypoetry/venv/bin/python3.11
Reason: tried: '/Users/nicolas.fantone/Library/Application Support/pypoetry/venv/bin/../../../../Python.framework/Versions/3.11/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/3.11/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.11/Python' (no such file, not in dyld cache)
Traceback:
File "<stdin>", line 923, in main
File "<stdin>", line 562, in run I'm curious as to where that @social-anthrax solution actually worked — but I'll admit, I'm not aware of the implications. |
Thank you @social-anthrax for the follow-up! My setup has evolved to include
Simulating installing a new version of Python (3.11.5 is the latest I see in pyenv currently so instead I downversioned to 3.11.4):
More generally, my expectation of the I have to admit to being confused that no matter which option we choose, external updates seem to be interfering with what should otherwise be an isolated virtual environment. Am I the problem here? |
@keithvsr I don't think you are. From Poetry's own docs:
This doesn't seem to be the case as removing/moving the global |
I was able to convert @social-anthrax's answer into a one liner so you don't have to download anything if you don't want to:
although this may not work in the future if |
Thank you @sebpretzer! This finally works now after much head-scratching. I upgraded Python via Homebrew as I normally do but for the first time doing an |
@keithvsr My apologies, I should have clarified that my code was only a fix for the reinstallation error rather than a fix for the underlying problem! |
I've opened #133 that should fix the installation issue with symlinks (#24), but as I also experienced this issue with upgrades previously myself, I am curious what the longer term or better fix should be to address this. Relative symlinks are clearly an issue, and if goal is to isolate poetry's own environment, would it make sense to resolve symlinks recursively until we find the real binary instead of installing with |
Issue experienced in Poetry 1.2.1
Python version 3.10.6_2 -> 3.10.7 and 3.10.7 -> 3.10.8 upgrades
OS version MacOS 12.6
(not project-specific so no pyproject.toml)
Issue
Poetry commands cease working and throw errors after upgrading the installed Python version using Homebrew. This has occurred the last two times (3.10.6_2 upgrade to 3.10.7 and 3.10.7 upgrade to 3.10.8) using
brew upgrade
which included the two Python updates. Afterward, attempting to use any Poetry command fails with error output similar to the following:In both cases, the only Python installations available are system packages (if these even still exist) or those installed by Homebrew. Poetry has only been installed via the recommended
curl -sSL https://install.python-poetry.org | python3 -
command. The only way I've found to restore Poetry functionality afterbrew upgrade
is to uninstall via the same recommended script i.e.curl -sSL https://install.python-poetry.org | python3 - --uninstall
and then to reinstall PoetryThe text was updated successfully, but these errors were encountered: