When using ansible (macOS) to fix this problem update your library:

pip install --upgrade --user boto3

notice the --user it will update, your local $HOME/Library/Python/2.7/lib/python/site-packages

By using --upgrade it will recreate the site-packages.

Or create PYTHONPATH system variable:

export PYTHONPATH=/usr/local/lib/python2.7/site-packages


In case you get this error:

Unicode-objects must be encoded before hashing", "unreachable": true


pip install --upgrade --user paramiko==2.0.6

To upgrade,reinstall ansible just in case:

pip install --upgrade --user ansible