Python Forum

Full Version: Mac os (M2) "Python is loading libcrypto in an unsafe way"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I have migrated to a mac os 12.6 with Python 3.10.7, and scripts involving ssl and hashing now complain with the error

Error:
/Library/Frameworks/Python.framework/Versions/3.10/Resources/Python.app/Contents/MacOS/Python is loading libcrypto in an unsafe way zsh: abort
I tried to solve it with:

Output:
python3 -m pip cache purge python3 -m pip install --upgrade cryptography python3 -m pip install --upgrade pyopenssl
Unsuccessfully.

But after installing openssl with homebrew, the scripts work if I execute them within the openssl directory:

Output:
cd /opt/homebrew/opt/openssl@3/lib/
So it is a library path related issue.

My question is: how do I tell python to consider loading relevant imports from that directory? I linked to /usr/local/lib but does not work either.

Cheers,
j
Well, I got a solution:

1) Unistall the python package obtained from the python website
2) Install the homebrew version with "brew install python", and verify with "python3 --version" and "which python3"
3) Install the following openssl implementation: "python3 -m pip install pyopenssl"

My old scripts now seem to work again.