Search code examples
ansibleparamiko

Ansible no module named paramiko


I'm trying to run an ansible playbook (ansible 2.9.6) but I keep getting the follwing error :

    "msg": "paramiko is not installed: No module named 'paramiko'"

Even though I have paramiko installed on the machine ( #48~18.04.1-Ubuntu):

Python 2.7.17
paramiko (2.7.2)

Any idea why?


Solution

  • The problem was the python interpreter:

    $ ansible --version
    ansible 2.9.6
    ...
      ansible python module location = /usr/lib/python3/dist-packages/ansible
      executable location = /usr/bin/ansible
      python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]
    ...
    

    Use ansible_python_interpreter inventory variable or the interpreter_python key in the [defaults] section of ansible.cfg to set the desired python interpreter.