-2

Trying to install lxml on mac osx yosemite for python 2.7.10

Using command pip install lxml, I receive: /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found #include ^ 1 error generated. error: command '/usr/bin/clang' failed with exit status 1

Complete error: Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools, tokenize;file='/private/var/folders/h2/hwn1y9sd54b6tl2wyb6vc_kh0000gp/T/pip-build-St5xbb/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /var/folders/h2/hwn1y9sd54b6tl2wyb6vc_kh0000gp/T/pip-8QC6OG-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/h2/hwn1y9sd54b6tl2wyb6vc_kh0000gp/T/pip-build-St5xbb/lxml

I have searched and cannot find a solution. Can someone please point me in the right direction?

epr8n
  • 45
  • 1
  • 7

1 Answers1

0

if you have xcode installed try the following

  $xcode-select --install

You could also try installing python via homebrew

  $brew install python

See these links that are related to you problem.

Fatal error: #include <stdio.h> generated after "pip install mysql-python" command

GCC fatal error: stdio.h: No such file or directory

Community
  • 1
  • 1
tockards
  • 189
  • 6
  • I already have python installed and I would prefer not to use xcode. – epr8n Oct 08 '15 at 22:28
  • How did you install it? I do believe the problem is related to missing libraries that can be installed by the above xocde-select command. – tockards Oct 08 '15 at 22:35
  • Ok, I installed python using homebrew (your same command), and then ran pip install lxml again. The terminal is hanging up and the top bar is switching between "xcrun" and "lipo" – epr8n Oct 08 '15 at 23:53
  • I found that resolving my xcrun/lipo bounce as described in: http://stackoverflow.com/questions/18667916/xcrun-lipo-freezes-with-os-x-mavericks-and-xcode-4-x was able to resolve that problem, and after this my lxml installation was successful. I suppose this was more of a build issue than an (incorrectly tagged) python issue :) thank you! – epr8n Oct 09 '15 at 00:09