super
super

Reputation: 181

easy_install lxml on mac not working

After running:

sudo easy_install lxml

I get the following error:

src/lxml/lxml.etree.c:165527: fatal error: error writing to -: Broken pipe

compilation terminated.

This looks like a c-compiler problem.

 gcc --version 

yields 4.2.1.

I don't really know what to do from here. Simply put, I want to install lxml on 10.6 OSX.

Upvotes: 3

Views: 2662

Answers (5)

somewhatoff
somewhatoff

Reputation: 981

I was unable to install using either pip or easy_install in my virtualenv in Lion until I did this:

STATIC_DEPS=true ./easy_install lxml

That did the trick.

Upvotes: 1

super
super

Reputation: 181

I just installed the gcc compiler and everything worked well.

https://github.com/kennethreitz/osx-gcc-installer

Upvotes: 0

Raymond Hettinger
Raymond Hettinger

Reputation: 226654

If you're on OS X Lion, you can try building with an alternate compiler:

export MACOSX_DEPLOYMENT_TARGET=10.7
export CC=clang

Upvotes: 0

Griffin
Griffin

Reputation: 644

export ARCHFLAGS='-arch i386 -arch x86_64'

Run the export command, as root, before trying pip or easy_install.

Upvotes: 3

chown
chown

Reputation: 52778

Try using pip:

[ 11:34 Jonathan@MacBookPro ~ ]$ sudo easy_install pip
Searching for pip
Reading http://pypi.python.org/simple/pip/
Reading http://www.pip-installer.org
Reading http://pip.openplans.org
Best match: pip 1.0.2
Downloading http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz#md5=47ec6ff3f6d962696fe08d4c8264ad49
Processing pip-1.0.2.tar.gz
Running pip-1.0.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-uVpOHL/pip-1.0.2/egg-dist-tmp-Qz2FYz
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 1.0.2 to easy-install.pth file
Installing pip script to /usr/local/bin
Installing pip-2.7 script to /usr/local/bin

Installed /Library/Python/2.7/site-packages/pip-1.0.2-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip


[ 11:34 Jonathan@MacBookPro ~ ]$ sudo pip install lxml
Downloading/unpacking lxml
  Downloading lxml-2.3.1.tar.gz (3.1Mb): 3.1Mb downloaded
  Running setup.py egg_info for package lxml
    Building lxml version 2.3.1.
    Building without Cython.
    Using build configuration of libxslt 1.1.24

    warning: no previously-included files found matching '*.py'
Installing collected packages: lxml
  Running setup.py install for lxml
    Building lxml version 2.3.1.
    Building without Cython.
    Using build configuration of libxslt 1.1.24
    building 'lxml.etree' extension
    llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -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 i386 -arch x86_64 -pipe -I/usr/include/libxml2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.7-intel-2.7/src/lxml/lxml.etree.o -w -flat_namespace
    llvm-gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.7-intel-2.7/src/lxml/lxml.etree.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.macosx-10.7-intel-2.7/lxml/etree.so
    building 'lxml.objectify' extension
    llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -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 i386 -arch x86_64 -pipe -I/usr/include/libxml2 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.objectify.c -o build/temp.macosx-10.7-intel-2.7/src/lxml/lxml.objectify.o -w -flat_namespace
^@    llvm-gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.7-intel-2.7/src/lxml/lxml.objectify.o -lxslt -lexslt -lxml2 -lz -lm -o build/lib.macosx-10.7-intel-2.7/lxml/objectify.so

Successfully installed lxml
Cleaning up...

Upvotes: 0

Related Questions