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.
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.
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.
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.
I have the same problem and simply resolved it with pip
installation.
pip install --user ansible
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With