Invalid dylib load Python Error
Here is how I fixed the Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI error on MacOS.
Recently I moved from the MacOS standard (old) terminal to zsh. I also updated all my brew packages. I'll be honest, I do not know which of those two things caused the issue, but the end result was that most of my Python-based programs were broken with the error report:
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI
After some hunting, I found the solution.
- Open a new terminal window and
cdto/usr/local/opt - List all directories which begin with 'openssl':
ls | grep '^openssl*'. I getopensslandopenssl@1.1 - Set the
DYLD_FALLBACK_LIBRARY_PATHvariable to point to thelibfolder of theopenssldirectory. Note: I chose theopenssl@1.1directory. Frankly that was just a guess (based on the fact that it has a version number and that is what the error was complaining about). I am not claiming that it's correct.export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib - Open a new terminal window and retry your script. It should now work.
Persisting The Parameter
To persist this parameter, write it into ~/.bashrc then run source ~/.bashrc
sudo nano ~/.bashrc
Paste this line into the file:
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/opt/openssl@1.1/lib
Now run source ~/.bashrc
As always, if you have any comments or suggestions, please do not hesitate to contact me.