3

Here is my python env: note that numpy is working

13:41:44/shared:5 $python Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from numpy import * >>> print mat([1,2,3]) [[1, 2, 3]] >>> 

But I am unable to install lxml. What is missing in my python and/or os configuration to make this work:

13:37:03/shared:4 $pip install --upgrade lxml Downloading/unpacking lxml Downloading lxml-3.2.4.tar.gz (3.3MB): 3.3MB downloaded Running setup.py egg_info for package lxml /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url' warnings.warn(msg) Building lxml version 3.2.4. Building without Cython. Using build configuration of libxslt 1.1.28 warning: no previously-included files found matching '*.py' warning: no files found matching '*.txt' under directory 'src/lxml/tests' Installing collected packages: lxml Running setup.py install for lxml /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'bugtrack_url' warnings.warn(msg) Building lxml version 3.2.4. Building without Cython. Using build configuration of libxslt 1.1.28 building 'lxml.etree' extension cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -I/usr/include/libxml2 -I/private/var/folders/k4/l5ww32y14svd5wmkgzzftl9m0000gn/T/pip_build_steve/lxml/src/lxml/includes -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.9-intel-2.7/src/lxml/lxml.etree.o -flat_namespace clang: warning: argument unused during compilation: '-mno-fused-madd' clang: warning: argument unused during compilation: '-flat_namespace' In file included from src/lxml/lxml.etree.c:314: **/private/var/folders/k4/l5ww32y14svd5wmkgzzftl9m0000gn/T/pip_build_steve/lxml/src/lxml/includes/etree_defs.h:9:10: fatal error: 'libxml/xmlversion.h' file not found #include "libxml/xmlversion.h"** ^ 1 error generated. 

1 Answer 1

5

It seems like you are missing libxml/xmlversion.h

Since it seems that /usr/include/libxml2 is being included, I think the most probable reason is that you don't have libxml2 installed on your system. This is most likely due to missing "command line tools". Get them here: https://developer.apple.com/downloads/index.action?=command%20line%20tools

Can also be solved by installing libxml2 via macports or brew (But don't do this other than as last resort). Using system libraries instead of homebrew or macports whenever possible can save you from a lot of incompatibility pitfalls.

Sign up to request clarification or add additional context in comments.

10 Comments

Hi i reinstalled libxml2 via homebrew. maybe the upgrade to mavericks 10.9.1 overwrote the prior install. Will get back here.
I did "brew install libxml2" which was successful. But "pip install --upgrade lxml" still fails with same error
Have you checked that /usr/include/libxml2 exists? I bet it doesn't, in which case my recommendation is to install command line tools from Apple. Preferring system libs when both system and homebrew are available will almost always save you some headache. PS. The reason why homebrew-libxml didn't solve it is that that /usr/local/include probably isn't included by pip while building. Before trying to hack that, I'd really suggest checking /usr/include and installing command line tools - that will probably solve it all :)
You are correct - the /usr/include/libxml2 does not exist. I just upgraded to 10.9.1 - did that wipe out the command line tools??
Yep. The "command line tools" are OS-specific and need to be re-installed each time you upgrade to a new "major version" of OSX.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.