Computer: MacBook Pro mid 2012, running El Capitan 10.11.4
Python version 2.7.10
I've been trying to install ansible from source, and I've run these two commands (following the steps on ansibles documentation):
git clone git://github.com/ansible/ansible.git --recursive
cd ./ansible
and then ran this
source ./hacking/env-setup
I've also already installed these packages
sudo pip install paramiko PyYAML Jinja2 httplib2 six
However, if I try and run ansible by typing it in the terminal, I get the following error.
Traceback (most recent call last):
File "/Users/[myusr]/rock/ansible/bin/ansible", line 81, in <module>
from ansible.cli.adhoc import AdHocCLI as mycli
File "/Users/[myusr]/rock/ansible/lib/ansible/cli/__init__.py", line 27, in <module>
import yaml
ImportError: No module named yaml
What should be done here?
@bigdata2's answer is correct but it might also happen that there's a conflict with python 3. So, check pip version (
pip --version
) and if it outputs python 3 then:So it gets installed for the same version as python.
I had this problem because I installed it with
instead of
Uninstalling and re-installing pyyaml fixed the problem for me.
Had the same issue. Got past it using @FranMowinckel's answer.
First I typed:
it outputted python 3. But, when I tried:
I got an error saying:
So, finally running:
everything worked fine. Go back and run:
(you may have to run this with all the other modules as well) Now you should finally be able to run your initial command which failed.
This should work:
Try this
For python 3.6 you can install it with
if there is a problem in importing, do
and then install it again: