Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install ansible due to python dependency on Ubuntu 18.04

I am trying to install ansible on my Ubuntu 18.04 which throws python depends error. I understand the version installed by default on the machine is 3.x +. The depends requests version of python to be 2.x i. e. 2.7 as per the below log results, Kindly suggest me a better option to install ansible or to downgrade the python version.

pawan@ubuntu:~/Devops$ sudo apt install -f ansible
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 ansible : Depends: python-jinja2 but it is not going to be installed
           Depends: python-yaml but it is not going to be installed
           Depends: python-paramiko but it is not going to be installed
           Depends: python-httplib2 but it is not going to be installed
           Depends: python-six but it is not going to be installed
           Depends: python-crypto (>= 2.6) but it is not going to be installed
           Depends: python-setuptools but it is not going to be installed
           Depends: python-cryptography but it is not going to be installed
           Depends: python:any (< 2.8)
           Depends: python:any (>= 2.7.5-5~)
E: Unable to correct problems, you have held broken packages.
like image 333
user1830049 Avatar asked Jul 29 '19 17:07

user1830049


People also ask

Which Python version is required for Ansible?

Currently Ansible can be run from any machine with Python 2 (version 2.7) or Python 3 (versions 3.5 and higher) installed. Windows isn't supported for the control machine. This includes Red Hat, Debian, CentOS, macOS, any of the BSDs, and so on.

What language dependency is needed for Ansible?

Prerequisites for installing Ansible You can install Ansible on any machine with Python 2 (version 2.7) or Python 3 (versions 3.5 and higher). With RHEL 7, we have Python 2.7 installed by default, and with RHEL 8, we have Python 3.6 by default.

Is Python required for Ansible?

Any ansible operation requires python on the target node except the raw and script modules. Please note that these two modules are primarily meant to install ansible requirements (i.e. Python and its mandatory modules) on targets where they are missing.


1 Answers

I have the same problem and simply resolved it with pip installation.

pip install --user ansible
like image 189
Andromeda Avatar answered Sep 19 '22 18:09

Andromeda