The Python Oracle

"ERROR:root:code for hash md5 was not found" when using any hg mercurial commands

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Unforgiving Himalayas Looping

--

Chapters
00:00 &Quot;Error:Root:Code For Hash Md5 Was Not Found&Quot; When Using Any Hg Mercurial Commands
02:26 Answer 1 Score 102
02:47 Accepted Answer Score 713
03:27 Answer 3 Score 53
03:57 Answer 4 Score 39
04:11 Thank you

--

Full question
https://stackoverflow.com/questions/5926...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #macos #openssl #mercurial #homebrew

#avk47



ACCEPTED ANSWER

Score 713


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.




ANSWER 2

Score 102


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)




ANSWER 3

Score 53


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 :)




ANSWER 4

Score 39


Just uninstall python2

$ brew uninstall python@2

If there is any error :

$ brew uninstall --ignore-dependencies python@2