Cody A. Ray

PyYAML using easy_install on Mac OS X (Lion)

December 6, 2011

Tried to install pyyaml today but got a couple nasty errors.

$ sudo easy_install  pyyaml<br />
Searching for pyyaml<br />
Reading http://pypi.python.org/simple/pyyaml/<br />
Reading http://pyyaml.org/wiki/PyYAML<br />
Best match: PyYAML 3.10<br />
Downloading http://pyyaml.org/download/pyyaml/PyYAML-3.10.zip<br />
Processing PyYAML-3.10.zip<br />
Running PyYAML-3.10/setup.py -q bdist_egg --dist-dir /tmp/easy_install-8Co0C6/PyYAML-3.10/egg-dist-tmp-FYdiLy<br />
build/temp.macosx-10.7-intel-2.7/check_libyaml.c:2:18: error: yaml.h: No such file or directory<br />
build/temp.macosx-10.7-intel-2.7/check_libyaml.c: In function ‘main’:<br />
build/temp.macosx-10.7-intel-2.7/check_libyaml.c:5: error: ‘yaml_parser_t’ undeclared (first use in this function)<br />
...<br />
lipo: can't open input file: /var/tmp//ccxDQipT.out (No such file or directory)

and

libyaml is not found or a compiler error: forcing --without-libyaml<br />
(if libyaml is installed correctly, you may need to<br />
 specify the option --include-dirs or uncomment and<br />
 modify the parameter include_dirs in setup.cfg)

Fortunately, after piecing together a couple posts, the fix is easy. Use the following command to install PyYAML.

sudo python -m easy_install pyyaml

We must install this way because the problem is a bug in an Python’s setuptools. Its been fixed in later versions, but for now this did the trick for me.

Resources

2 comments

Imported from the previous site.

futanow· March 1, 2015
Hi , i have used your method. sudo python -m easy_install pyyaml /usr/bin/python: No module named easy_install
codyaray· March 1, 2015
Sounds like you need to install easy_install itself first.
© 2009–2026 Cody A. Ray
RSSGitHubLinkedIn