boto3 gone AWOL?!?

My Ansible playbooks are failing with this message:

fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “Python modules "botocore" or "boto3" are missing, please install both”}

But boto3 and botocore ARE installed:

kauer@kt:~/dev/ansible/bc-ansible-automation/projects/adfs$ sudo -H pip install boto3
Requirement already satisfied: boto3 in /usr/local/lib/python3.5/dist-packages (1.8.4)
Requirement already satisfied: botocore<1.12.0,>=1.11.4 in /usr/local/lib/python3.5/dist-packages (from boto3) (1.11.4)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in /usr/local/lib/python3.5/dist-packages (from boto3) (0.1.13)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /usr/local/lib/python3.5/dist-packages (from boto3) (0.9.3)
Requirement already satisfied: urllib3<1.24,>=1.20 in /usr/local/lib/python3.5/dist-packages (from botocore<1.12.0,>=1.11.4->boto3) (1.23)
Requirement already satisfied: docutils>=0.10 in /usr/local/lib/python3.5/dist-packages (from botocore<1.12.0,>=1.11.4->boto3) (0.13.1)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1; python_version >= “2.7” in /usr/local/lib/python3.5/dist-packages (from botocore<1.12.0,>=1.11.4->boto3) (2.6.0)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil<3.0.0,>=2.1; python_version >= “2.7”->botocore<1.12.0,>=1.11.4->boto3) (1.10.0)

kauer@kt:~/dev/ansible/bc-ansible-automation/projects/adfs$ sudo -H pip install botocore
Requirement already satisfied: botocore in /usr/local/lib/python3.5/dist-packages (1.11.4)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1; python_version >= “2.7” in /usr/local/lib/python3.5/dist-packages (from botocore) (2.6.0)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /usr/local/lib/python3.5/dist-packages (from botocore) (0.9.3)
Requirement already satisfied: docutils>=0.10 in /usr/local/lib/python3.5/dist-packages (from botocore) (0.13.1)
Requirement already satisfied: urllib3<1.24,>=1.20 in /usr/local/lib/python3.5/dist-packages (from botocore) (1.23)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil<3.0.0,>=2.1; python_version >= “2.7”->botocore) (1.10.0)

I get the same output without the -H option to sudo too.

I can see boto3 in these two locations on my system:

/usr/local/lib/python2.7/dist-packages/boto3

/usr/local/lib/python3.5/dist-packages/boto3

Is it some sort of path thing? I cannot figure out what’s changed.

Regards, K.

More info on this below. What the heck is a jmespath and where do i get one? Clearly both boto3 and botocore are being found.

To answer my own question, it turns out this is an installable library, which I just installed (sudo apt-get install python-jmespath). And now Ansible can talk to AWS again.

But what the heck made this library go away?

Anyway, sorry for the noise.

Regards, K.

kauer@kt:~/dev/ansible/bc-ansible-automation/projects/adfs$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import boto3
Traceback (most recent call last):
File “”, line 1, in
File “/usr/local/lib/python2.7/dist-packages/boto3/init.py”, line 16, in
from boto3.session import Session
File “/usr/local/lib/python2.7/dist-packages/boto3/session.py”, line 17, in
import botocore.session
File “/usr/local/lib/python2.7/dist-packages/botocore/session.py”, line 27, in
import botocore.client
File “/usr/local/lib/python2.7/dist-packages/botocore/client.py”, line 16, in
from botocore import waiter, xform_name
File “/usr/local/lib/python2.7/dist-packages/botocore/waiter.py”, line 13, in
import jmespath
ImportError: No module named jmespath

tou should check out virtualenv or pipenv. They can make this process easier.