# aws\_s3 module fails, says Boto3 is missing when it is not - bug?

**URL:** <https://forum.ansible.com/t/aws-s3-module-fails-says-boto3-is-missing-when-it-is-not-bug/29963>\
**Category:** Ansible Project\
**Created:** [March 22, 2019, 9:18pm UTC](https://forum.ansible.com/t/aws-s3-module-fails-says-boto3-is-missing-when-it-is-not-bug/29963 "2019-03-22T21:18:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gigit1000](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@gigit1000](https://forum.ansible.com/u/gigit1000)\
**Post date:** [March 22, 2019, 9:18pm UTC](https://forum.ansible.com/t/aws-s3-module-fails-says-boto3-is-missing-when-it-is-not-bug/29963/1 "2019-03-22T21:18:30Z")

</div>

This Play installs python3, pip3, boto3 and botocore, and trys to use aws\_s3 module to download a file:

TASK [run yum update -y using yum module] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ok: [ip-10-200-2-137.us-west-2.compute.internal]

TASK [Install python3 and pip3] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [ip-10-200-2-137.us-west-2.compute.internal]

TASK [Install boto3 and botocore with pip3 module] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [ip-10-200-2-137.us-west-2.compute.internal]

TASK [Create a directory if it does not exist using file module] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
changed: [ip-10-200-2-137.us-west-2.compute.internal]

TASK [downlod file from s3 with aws\_s3 module] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
fatal: [ip-10-200-2-137.us-west-2.compute.internal]: FAILED! =\> {“changed”: false, “msg”: “Python modules "botocore" or "boto3" are missing, please install both”}

It fails because it says boto3 is missing, but it actually is not:

From the Target host you can see that boto3 is installed:

[ec2-user@ip-10-200-2-137 ~]$ pip3 freeze  
boto3==1.9.120  
botocore==1.12.120  
docutils==0.14  
jmespath==0.9.4  
python-dateutil==2.8.0  
s3transfer==0.2.0  
six==1.12.0  
urllib3==1.24.1  
[ec2-user@ip-10-200-2-137 ~]

Is this is bug? Thank you for any help

This is the task that fails:

- name: downlod file from s3 with aws\_s3 module aws\_s3: bucket: mybucket object: mybucket/jre-8u201-linux-x64.tar.gz dest: /home/ec2-user/updater/jre-8u201-linux-x64.tar.gz mode: get

---

<div class="post-metadata">

**Author:** ![Sudheer\_S1](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@Sudheer\_S1](https://forum.ansible.com/u/Sudheer_S1)\
**Post date:** [March 23, 2019, 11:51am UTC](https://forum.ansible.com/t/aws-s3-module-fails-says-boto3-is-missing-when-it-is-not-bug/29963/2 "2019-03-23T11:51:30Z")

</div>

> This Play installs python3, pip3, boto3 and botocore, and trys to use aws\_s3 module to download a file:
> 
> TASK [run yum update -y using yum module] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> ok: [ip-10-200-2-137.us-west-2.compute.internal]
> 
> TASK [Install python3 and pip3] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> changed: [ip-10-200-2-137.us-west-2.compute.internal]
> 
> TASK [Install boto3 and botocore with pip3 module] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> changed: [ip-10-200-2-137.us-west-2.compute.internal]
> 
> TASK [Create a directory if it does not exist using file module] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> changed: [ip-10-200-2-137.us-west-2.compute.internal]
> 
> TASK [downlod file from s3 with aws\_s3 module] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> fatal: [ip-10-200-2-137.us-west-2.compute.internal]: FAILED! =\> {"changed": false, "msg": "Python modules \"botocore\" or \"boto3\" are missing, please install both"}
> 
> It fails because it says boto3 is missing, but it actually is not:
> 
> From the Target host you can see that boto3 is installed:
> 
> [ec2-user@ip-10-200-2-137 ~]$ pip3 freeze  
> boto3==1.9.120  
> botocore==1.12.120  
> docutils==0.14  
> jmespath==0.9.4  
> python-dateutil==2.8.0  
> s3transfer==0.2.0  
> six==1.12.0  
> urllib3==1.24.1  
> [ec2-user@ip-10-200-2-137 ~]
> 
> Is this is bug? Thank you for any help
> 
> This is the task that fails:  
> - name: downlod file from s3 with aws\_s3 module aws\_s3: bucket: mybucket object: mybucket/jre-8u201-linux-x64.tar.gz dest: /home/ec2-user/updater/jre-8u201-linux-x64.tar.gz mode: get  
> --  
> You received this message because you are subscribed to the Google Groups "Ansible Project" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com \<mailto:ansible-project+unsubscribe@googlegroups.com\>.  
> To post to this group, send email to ansible-project@googlegroups.com \<mailto:ansible-project@googlegroups.com\>.  
> To view this discussion on the web visit [https://groups.google.com/d/msgid/ansible-project/e81f25a5-1104-4b36-b2a4-5a037610a9b9%40googlegroups.com?utm\_medium=email&utm\_source=footer&gt;\](https://groups.google.com/d/msgid/ansible-project/e81f25a5-1104-4b36-b2a4-5a037610a9b9%40googlegroups.com?utm_medium=email&utm_source=footer&gt;%5C).

This doesn't look like a bug. It looks like boto is not available via the Python interpreter Ansible is using on the target.

SSH on to the target, start the Python interpreter and see if you can import boto:

python  
Python 2.7.12 (default, Nov 12 2018, 14:36:49)  
[GCC 5.4.0 20160609] on linux2  
Type "help", "copyright", "credits" or "license" for more information.

---

<div class="post-metadata">

**Author:** ![gigit1000](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@gigit1000](https://forum.ansible.com/u/gigit1000)\
**Post date:** [March 25, 2019, 6:26pm UTC](https://forum.ansible.com/t/aws-s3-module-fails-says-boto3-is-missing-when-it-is-not-bug/29963/3 "2019-03-25T18:26:19Z")

</div>

Thank you - the target host has Python2 and Python3 installed:

[ec2-user@ip-10-200-2-198 ~]$ which python  
/usr/bin/python  
[ec2-user@ip-10-200-2-198 ~]$ which python3  
/usr/bin/python3

Python2 is installed by default. Python3 was installed by my playbook. Using your example I can see that Python2 does not have boto. Python3 does have boto3 which was also installed by my playbook.

My ansible cfg looks like this:

[defaults]  
private\_key\_file=/home/ec2-user/key.pem  
ansible\_python\_interpreter=/usr/bin/python3

I thought I could force ansible to use python3, but it did not work. I got the same result.

---

<div class="post-metadata">

**Author:** ![gigit1000](https://avatars.discourse-cdn.com/v4/letter/g/a87d85/32.png) [@gigit1000](https://forum.ansible.com/u/gigit1000)\
**Post date:** [March 25, 2019, 9:36pm UTC](https://forum.ansible.com/t/aws-s3-module-fails-says-boto3-is-missing-when-it-is-not-bug/29963/4 "2019-03-25T21:36:00Z")

</div>

I was able to get this working by specifying the interpreter at the task level:

- name: downlod file from s3 with aws\_s3 module aws\_s3: vars: ansible\_python\_interpreter: /usr/bin/python3 bucket: kavise-launch-data object: jre-8u201-linux-x64.tar.gz dest: /home/ec2-user/updater/jre-8u201-linux-x64.tar.gz
