Python headers are required to build Mercurial

I have been following step by step the screencast of kennethlove titled "Getting Started with django". I am stuck in "Episode 6: Generic Views Are Cheaper Than Namebrand". I am trying to install "django-annoying" which requires "Mercurial".

Im using OSX 10.8.2 and when I run on the terminal: pip install mercurial I get the message below.

  Downloading/unpacking mercurial
  Downloading mercurial-2.3.2.tar.gz (3.6MB): 3.6MB downloaded
  Running egg_info for package mercurial

    Python headers are required to build Mercurial
    Complete output from command python egg_info:
    running egg_info

creating pip-egg-info/mercurial.egg-info

writing pip-egg-info/mercurial.egg-info/PKG-INFO

writing top-level names to pip-egg-info/mercurial.egg-info/top_level.txt

writing dependency_links to pip-egg-info/mercurial.egg-info/dependency_links.txt

writing manifest file 'pip-egg-info/mercurial.egg-info/SOURCES.txt'

warning: manifest_maker: standard file '-c' not found

Python headers are required to build Mercurial

Command python egg_info failed with error code 1 in /Users/gth158a/Sites/official/poll/build/mercurial
Storing complete log in /Users/gth158a/.pip/pip.log

I have been searching for a solution and the closest I have found is somebody having the same issue in Ubuntu but his proposed solution does not apply in my osx case.

From my research, I learned that the headers referred to are "C headers" to build the app. I have installed the packages I have found in pip that have C headers in its description but no success at all. I would greatly appreciate it if you can point me in the right direction.


Most probably is just that you don't have the Command Line Tools installed.

The easiest way to install them is to open Xcode go to preferences, Downloads, Components tab --> Command Line Tools (Install)

I had the same problem on Ubuntu. I installed the "python-dev" package using following command..

sudo apt-get install python-dev

I think installing the same would help for any flavour of Linux.

Pip won't help because it installs python packages. The Python headers are usually installed system-wide. According to this XCode installs the Python headers

Need Your Help

How to set config.action_controller.default_url_options = {:host = '#''} on per environment basis

ruby-on-rails ruby-on-rails-3 actioncontroller

Right now I'm using this which works for the development host, but I have to manually change the {:host => ""} code when I move to production.

Why are there recovered references in my xcode project file?


I have a react native app and just noticed that a few lines were added for Recovered References in my project.pbxproj file in XCode.