"ERROR:root:code for hash md5 was not found" when using any hg mercurial commands
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.
Managed to fix this by first unlinking openssl
brew unlink openssl
And then reinstalling python
brew reinstall python@2
I also noticed that when running 'brew doctor' there was a warning related to an openssl folder found in /usr/local/include/node/. I deleted this folder before running the above commands (not sure if related)
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 :)
Just uninstall python2
$ brew uninstall python@2
If there is any error :
$ brew uninstall --ignore-dependencies python@2
My problem was having pyenv
installed and pointing to an old python 2 version
Uninstall python@2 (python2 was EOL since Jan 1st, 2020)
$ brew uninstall python@2
Uninstalling /usr/local/Cellar/python@2/2.7.15_1... (4,169 files, 76.0MB)
then
$ pyenv versions
system
* 2.7.12 (set by /Users/admin/.python-version)
3.4.5
3.7.7
$ pyenv local system
$ pyenv global system