Ansible-galaxy throws ImportError: No module named yaml
Solution 1
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
Solution 2
For me pip install yaml
doesn’t work in Mavericks.
pip install pyyaml
works
Solution 3
I tried the pip install yaml
answer, and it didn't work for me. I had to reinstall ansible in order for the command line to catch. IE,
failing
ansible-galaxy install bcen01.nodejs [43m] ✭
Traceback (most recent call last):
File "/usr/local/Cellar/ansible/1.4.3/libexec/bin/ansible-galaxy", line 34, in <module>
import yaml
ImportError: No module named yaml
reinstall
brew reinstall ansible
success
ansible-galaxy install bcen01.nodejs [43m] ✭
no version specified, installing master
- downloading role from https://github.com/bcen/ansible-nodejs/archive/master.tar.gz
- extracting bcen01.nodejs to /usr/local/etc/ansible/roles/bcen01.nodejs
bcen01.nodejs was installed successfully
Solution 4
Try installing with
sudo python -m easy_install pyyaml
The problem isn't in pyyaml, its in your version of setuptools. See http://codyaray.com/2011/12/pyyaml-using-easy_install-on-mac-os-x-lion for references
Comments
-
Alexander Vagin almost 2 years
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.3Does anyone know how to fix it?