Ansible-galaxy throws ImportError: No module named yaml

Alexander Vagin picture Alexander Vagin · Jan 7, 2014 · Viewed 28.4k times · Source


When I try to install ansible role, I see this exception.

 $ ansible-galaxy install zzet.postgresql
 Traceback (most recent call last):
 File "/Users/myHomeDir/.homebrew/Cellar/ansible/1.4.3/libexec/bin/ansible-galaxy", line 34, in <module>
 import yaml
 ImportError: No module named yaml

OS: Mac Os Maverick
Ansible: 1.4.3

Does anyone know how to fix it?

Answer

Vilsepi picture Vilsepi · Jan 7, 2014

Based on the error message, it tries to import the python module yaml but cannot find it. The yaml module is called pyyaml when you install it with pip:

pip install pyyaml

If pip is not installed on your mac then you can install it as,

easy_install pip