Skip to content


PyYAML using easy_install on Mac OS X (Lion)

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

$ sudo easy_install  pyyaml
Searching for pyyaml
Reading http://pypi.python.org/simple/pyyaml/
Reading http://pyyaml.org/wiki/PyYAML
Best match: PyYAML 3.10
Downloading http://pyyaml.org/download/pyyaml/PyYAML-3.10.zip
Processing PyYAML-3.10.zip
Running PyYAML-3.10/setup.py -q bdist_egg --dist-dir /tmp/easy_install-8Co0C6/PyYAML-3.10/egg-dist-tmp-FYdiLy
build/temp.macosx-10.7-intel-2.7/check_libyaml.c:2:18: error: yaml.h: No such file or directory
build/temp.macosx-10.7-intel-2.7/check_libyaml.c: In function ‘main’:
build/temp.macosx-10.7-intel-2.7/check_libyaml.c:5: error: ‘yaml_parser_t’ undeclared (first use in this function)
...
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
(if libyaml is installed correctly, you may need to
 specify the option --include-dirs or uncomment and
 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

  • http://pyyaml.org/ticket/186
  • http://pyyaml.org/ticket/94
  • http://andreasjacobsen.com/2008/10/10/using-python-setuptools-on-the-mac/

Posted in Tutorials.


2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. futanow says

    Hi , i have used your method.
    sudo python -m easy_install pyyaml
    /usr/bin/python: No module named easy_install

  2. codyaray says

    Sounds like you need to install easy_install itself first.



Some HTML is OK

or, reply to this post via trackback.



Log in here!