0

So I'm trying to install pip on my macOS and when I'm running sudo python get-pip.py command and I'm getting the following error:

ERROR:root: code for hash md5 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "get-pip.py", line 23704, in <module>
    main()
  File "get-pip.py", line 198, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 83, in bootstrap
    from pip._internal.commands.install import InstallCommand
  File "/var/folders/l8/m4y81mrx6x37cslmws_mg91c0000gn/T/tmphs0wnS/pip.zip/pip/_internal/commands/install.py", line 17, in <module>
  File "/var/folders/l8/m4y81mrx6x37cslmws_mg91c0000gn/T/tmphs0wnS/pip.zip/pip/_internal/cli/req_command.py", line 16, in <module>
  File "/var/folders/l8/m4y81mrx6x37cslmws_mg91c0000gn/T/tmphs0wnS/pip.zip/pip/_internal/index/collector.py", line 14, in <module>
  File "/var/folders/l8/m4y81mrx6x37cslmws_mg91c0000gn/T/tmphs0wnS/pip.zip/pip/_vendor/requests/__init__.py", line 43, in <module>
  File "/var/folders/l8/m4y81mrx6x37cslmws_mg91c0000gn/T/tmphs0wnS/pip.zip/pip/_vendor/urllib3/__init__.py", line 7, in <module>
  File "/var/folders/l8/m4y81mrx6x37cslmws_mg91c0000gn/T/tmphs0wnS/pip.zip/pip/_vendor/urllib3/connectionpool.py", line 29, in <module>
  File "/var/folders/l8/m4y81mrx6x37cslmws_mg91c0000gn/T/tmphs0wnS/pip.zip/pip/_vendor/urllib3/connection.py", line 41, in <module>
  File "/var/folders/l8/m4y81mrx6x37cslmws_mg91c0000gn/T/tmphs0wnS/pip.zip/pip/_vendor/urllib3/util/__init__.py", line 7, in <module>
  File "/var/folders/l8/m4y81mrx6x37cslmws_mg91c0000gn/T/tmphs0wnS/pip.zip/pip/_vendor/urllib3/util/ssl_.py", line 8, in <module>
ImportError: cannot import name md5

I had a look at this answer, which talks about the same problem but the author faced this problem while using AWS and here in my case I'm using my local system, thus not able to take any help from that answer. Any help would be highly appreciated. Thanks!

iklinac
  • 14,944
  • 4
  • 28
  • 30
AnonSar
  • 556
  • 1
  • 7
  • 24
  • 2
    Python 2.7's been EOL for nearly a year, so you probably shouldn't be using it. Your Python 2.7 appears to be from Homebrew, and somehow doesn't have a single cryptographic hash module installed - this seems broken. You might want to uninstall that Python and reinstall it again from Homebrew, or consider grabbing a python.org package instead. (And use Python 3 if at all possible!) – nneonneo Dec 10 '20 at 08:45

0 Answers0