Solution to "ImportError cannot open shared object file No such file or directory"

Is poetry install giving you lots of errors containing ImportError: cannot open shared object file: No such file or directory ?

The python version you installed is referencing a dynamic library that is no longer present on your system. In this case, the libffi on my system has been upgraded. In the previous version there was a, but in the new version is a

My python version installed through the AUR was built against the old version and is still referencing (I installed python38 using yay).

It is possible to rebuild. This wil make python38 reference and everything will be fine again. You do this by running yay --rebuild -S python38.


If you did not install python38 (on arch linux based system), but you are using for example pyenv to manage your python versions. You need to rehash. You need to run pyenv rehash, because the dependencies you built python against changed. (For more information read:


After running this you can run poetry install without errors again. I use Arch BTW.