"requests_ntlm is not installed", when it appears to be in place

Has anyone out there seen this issue – when running win_ping against a host – and been able to resolve it(?):

< target host > | UNREACHABLE! => {

“changed”: false,

“msg”: “ntlm: requested auth method is ntlm, but requests_ntlm is not installed”,

“unreachable”: true

}

Checking what I have installed, I see:

I would try and import the requests_ntlm package and try and find out why it is failing to be imported. It could be that a required package like cryptography isn’t installed. To do this run

`
python -c “from requests_ntlm import HttpNtlmAuth”

`

If the import fails it will give you an error saying what it failed to import and give you an indication of what needs to happen. Make sure when you are testing this you are running the command on the Python that Ansible is installed from.

Thanks

Jordan

Ok,

Here’s what I got, so, I’ll see what I can find on the module mentioned:

MacBook-Pro:playbooks anthony$ python -c “from requests_ntlm import HttpNtlmAuth”
Traceback (most recent call last):
File “”, line 1, in
File “/Library/Python/2.7/site-packages/requests_ntlm/init.py”, line 1, in
from .requests_ntlm import HttpNtlmAuth
File “/Library/Python/2.7/site-packages/requests_ntlm/requests_ntlm.py”, line 5, in
from cryptography import x509
ImportError: No module named cryptography

'Looks like the system sees it as already being installed:

MacBook-Pro:playbooks anthony$ pip2.7 install pycrypto
Requirement already satisfied (use --upgrade to upgrade): pycrypto in /Library/Python/2.7/site-packages
Cleaning up…

Pycrypto is not the same as cryptography, the package is literally called cryptography and should be installed.

Thanks

Jordan

I’m still getting the same error:

(ansible) MacBook-Pro:playbooks anthony$ ansible wrk04 -e @~/.ansible/secure.yml -m win_ping --ask-vault-pass
Vault password:
wrk04 | UNREACHABLE! => {
“changed”: false,
“msg”: “ntlm: requested auth method is ntlm, but requests_ntlm is not installed”,
“unreachable”: true
}
(ansible) MacBook-Pro:playbooks anthony$ pip freeze | grep crypto
asn1crypto==0.24.0
cryptography==2.2.2

Are you still getting the import error when trying to manually import cryptography, you need to solve that first before using Ansible.

No, I’m no longer seeing the error on attempt to manually import cryptography.

What about import requests_ntlm? If that works but Ansible doesn’t it sounds like Ansible is using a different Python interpreter to the one you tested on.

Does this shed any light(?):

(ansible) MacBook-Pro:playbooks anthony$ ansible wrk04 -e @~/.ansible/secure.yml -m win_ping --ask-vault-pass
Vault password:
wrk04 | UNREACHABLE! => {
“changed”: false,
“msg”: “ntlm: requested auth method is ntlm, but requests_ntlm is not installed”,
“unreachable”: true
}
(ansible) MacBook-Pro:playbooks anthony$ python -c “from requests_ntlm import requests_ntlm”
(ansible) MacBook-Pro:playbooks anthony$ echo $?
0
(ansible) MacBook-Pro:playbooks anthony$ python -c “import requests_ntlm”
(ansible) MacBook-Pro:playbooks anthony$ echo $?
0
(ansible) MacBook-Pro:playbooks anthony$ which python
/Users/anthony/ansible/bin/python
(ansible) MacBook-Pro:playbooks anthony$ ansible --version
ansible 2.5.0
config file = /Users/anthony/.ansible.cfg
configured module search path = [u’/Users/anthony/.ansible/plugins/modules’, u’/usr/share/ansible/plugins/modules’]
ansible python module location = /Library/Python/2.7/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 2.7.10 (default, Oct 6 2017, 22:29:07) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]

Looks like the python on your PATH is at /Users/anthony/ansible/bin/python but the Ansible command is on /Library/Python/2.7 which is different.