When trying to use any hg
Mercurial commands on the console, I keep getting this error.
I installed Python using Homebrew and I am running Mac OS Catalina v. 1
Just uninstall python2
$ brew uninstall python@2
If there is any error :
$ brew uninstall --ignore-dependencies python@2
The case for me is that when I install dependencies of a django web app, it messes up the environment. When I type cd
, it shows the same error.
The problem was the openssl
library, it can not find the correct ones.
If you are on Macintosh, you can type
ls /usr/local/Cellar/openssl
to see all the versions,
brew switch openssl 1.0.XXXX
to choose the available openssl version.
Then the error is gone :)
Running brew reinstall python@2
didn't work for my existing Python 2.7 virtual environments. Inside them there were still ERROR:root:code for hash sha1 was not found
errors.
I encountered this problem after I ran brew upgrade openssl
. And here's the fix:
$ ls /usr/local/Cellar/openssl
...which shows
1.0.2t
According to the existing version, run:
$ brew switch openssl 1.0.2t
...which shows
Cleaning /usr/local/Cellar/openssl/1.0.2t
Opt link created for /usr/local/Cellar/openssl/1.0.2t
After that, run the following command in a Python 2.7 virtualenv:
(my-venv) $ python -c "import hashlib;m=hashlib.md5();print(m.hexdigest())"
...which shows
d41d8cd98f00b204e9800998ecf8427e
No more errors.
The next solution worked for me on MacOS Catalina:
brew unlink openssl
brew install python@2
)brew tap-new <user>/homebrew-python2
brew extract python@2 <user>/homebrew-python2
brew reinstall /usr/local/Homebrew/Library/Taps/<user>/homebrew-python2/Formula/python@2.7.17.rbl
After installing openssl
I got the same problem. This answer didn't help me, but after manual linking of libcrypto.1.1.dylib
and libssl.1.1.dylib
everything start working. In my case it was:
ln -s /usr/local/opt/openssl/lib/libcrypto.1.1.dylib /usr/local/lib
ln -s /usr/local/opt/openssl/lib/libssl.1.1.dylib /usr/local/lib
My problem was multiple versions of python installed (python was still aliased to python2 but i wanted pip to use python3). i also have a python3
bin installed on my system
# use pip with python3
$ python3 -m pip install fish
see Dealing with multiple Python versions and PIP? for details