Recently when trying to run a Python script on my Mac, I faced an import error for a specific Python module:

ImportError: No module named boto.sts

The error

I thought that the solution would be rather easy; I could just use Python’s package installer, pip, and install boto.sts. However, when I tried running $ pip install boto, I received a frustrating and confusing error:

Traceback (most recent call last):
	  File "/usr/local/bin/pip", line 11, in <module>
	    load_entry_point('pip==19.1.1', 'console_scripts', 'pip')()
	  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
	    return get_distribution(dist).load_entry_point(group, name)
	  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2843, in load_entry_point
	    return ep.load()
	  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2434, in load
	    return self.resolve()
	  File "/usr/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2440, in resolve
	    module = __import__(self.module_name, fromlist=['__name__'], level=0)
	  File "/usr/local/lib/python2.7/site-packages/pip/_internal/__init__.py", line 19, in <module>
	    from pip._vendor.urllib3.exceptions import DependencyWarning
	  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
	    from .connectionpool import (
	  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 29, in <module>
	    from .connection import (
	  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/urllib3/connection.py", line 38, in <module>
	    from .util.ssl_ import (
	  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/urllib3/util/__init__.py", line 6, in <module>
	    from .ssl_ import (
	  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/urllib3/util/ssl_.py", line 8, in <module>
	    from hashlib import md5, sha1, sha256
	ImportError: cannot import name md5

“Okay,” I thought. “I probably just need to go on a little _pip_ journey and install _md5_.” No such luck. Same error — this, to me, indicated more of an issue with pip than anything.

#python #programming

How to fix md5 ImportError with Python 2 and pip
28.00 GEEK