pypipython-3.x95% confidence\u2191 39

poetry returns 'dyld: Library not loaded ... image not found' following brew install while inside virtual environment

Full error message
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

I faced this issue because when I executed brew install, brew updated the patch version of Python from 3.9.13_1 to 3.9.14. This can be easily resolved by running the following to uninstall and then install poetry. curl -sSL https://install.python-poetry.org | python3 - --uninstall curl -sSL https://install.python-poetry.org | python3 -

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/bd6d2a1ba0fa130ed5ea9a6ced2f61b0c1d5874443dc0f8ab0437d989a4dc130
hash \u00b7 bd6d2a1ba0fa130ed5ea9a6ced2f61b0c1d5874443dc0f8ab0437d989a4dc130
poetry returns &#39;dyld: Library not loaded ... image not f… — DepScope fix | DepScope