Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ansible-Playbook: Error Message "Unable to find any of pip3 to use. pip needs to be installed"

Tags:

ansible

I try to install boto3 via ansible in my playbook.

I tried to create a new user on my host.

- name: "test user"
  hosts: test
  tasks:
   - name: "install boto3"
      pip:
        name: boto3
        executable: pip3

I got this message :

{"changed": false, "msg": "Unable to find any of pip3 to use.  pip needs to be installed."}
like image 389
danaso Avatar asked Aug 30 '19 14:08

danaso


2 Answers

Install Python3-pip before the failing step

- name: install pip3
  apt: name=python3-pip state=present 
like image 159
nomulex Avatar answered Oct 22 '22 21:10

nomulex


First of all these are the requirements of pip ansible module as specified on ansible docs, Docs Link: https://docs.ansible.com/ansible/latest/modules/pip_module.html

  • pip
  • virtualenv
  • setuptools

Secondly, you have mentioned pip3 in executable field, which makes it to use python3, and it may be possible that python3 is not installed on the host and python2 is available.

So, either leave that field or check the proper python version installed and update the value of executable field accordingly.

like image 42
Shubham Vaishnav Avatar answered Oct 22 '22 20:10

Shubham Vaishnav