'poetry returns 'dyld: Library not loaded ... image not found' following brew install while inside virtual environment
I ran brew install postgresql while inside a poetry environment. Since then, I can't interact with poetry.
λ ~/ poetry
dyld: Library not loaded: /usr/local/Cellar/[email protected]/3.9.9/Frameworks/Python.framework/Versions/3.9/Python
Referenced from: /Users/<my username>/Library/Application Support/pypoetry/venv/bin/python
Reason: image not found
[1] 5634 abort poetry
I get the same output when I try poetry <any other command>. I tried removing my virtual environments from λ ~/Library/Caches/pypoetry/virtualenvs/ expecting to be able to reinstall them from the .toml files in my projects, but can't run poetry install because I receive the same error.
I am running MacOS 10.15.7, Homebrew 3.3.12, poetry 1.1.12, & pyenv 2.2.4.
ECHO $PATH
/Users/<my username>/.poetry/bin:~/.local/bin:/Users/<my username>/Library/Python/3.9/bin:/shims:/Users/<my username>/.datacoral/cli/bin:/Users/<my username>/.nvm/versions/node/v12.13.0/bin:/Users/<my username>/bin:/usr/local/bin:/Users/<my username>/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/<my username>/.local/bin:/Users/<my username>/.local/bin
Solution 1:[1]
I'm resolving this in case someone runs into the same issue.
Uninstalling and reinstalling poetry fixed the problem. I wasn't able to do this with the --uninstall option and instead had to do it manually. I first ran rm -rf pypoetry inside ~/Library/Application Support/. Then I re-ran the install line from poetry's site: curl -sSL https://install.python-poetry.org | python3 -.
The cause of the issue was using poetry shell instead of just poetry run jupyterlab –– this opened me up to absent-mindedly screwing up the poetry install by running brew installs while in the shell. Lesson learned!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | eve-hunt |
