Anisible pip3 install keeps failing on remote service (No setuptools found in remote host, please install it first) Anisible pip3 install keeps failing on remote service (No setuptools found in remote host, please install it first) python-3.x python-3.x

Anisible pip3 install keeps failing on remote service (No setuptools found in remote host, please install it first)


Ansible needs setuptools to be installed for the version of Python that is being used to run Ansible modules, which, by default, is Python 2. So you need to run pip2 install setuptools or equivalent in order to install setuptools in Python 2.


The setuptools package must be installed for both the Ansible Python interpreter and for the version of Python specified by this option.

Which means you have to install setuptools for python2 and python3. Here are my codes before pip install:

    - name: install python-setuptools      package:        name: python-setuptools        state: present


Here is an my ansible role for using pip3 and installing aws-cli

---- name: Install Dependencies  apt:    name: ['python3-pip', 'python3-setuptools', 'python3.8', 'python3.8-venv']    state: latest    update_cache: yes- name: Install AWSCLI  pip:    name: 'awscli'    virtualenv_python: /usr/bin/python3