Giter Club home page Giter Club logo

Comments (16)

orukusaki avatar orukusaki commented on May 17, 2024 67

I know this is an old issue, but I've been experiencing a very similar one recently (though it was actually the Nokogiri Ruby gem that I was trying to install), and Googling brought me here.

I got past it by symlinking the Homebrew install of libxml2 to the usual include path:

sudo ln -s /usr/local/opt/libxml2/include/libxml2/libxml /usr/local/include/libxml

This might not be ideal for all situations, but works for me for now.

from mitmproxy.

guidoilbaldo avatar guidoilbaldo commented on May 17, 2024 56

Hi, update on this with macOS Mojave: I still had the problem after installing both CLI tools with xcode-select --install and libxml2 / libxslt with brew.
The only thing that fixed the problem was installing missing legacy headers as pointed out here: https://silvae86.github.io/sysadmin/mac/osx/mojave/beta/libxml2/2018/07/05/fixing-missing-headers-for-homebrew-in-mac-osx-mojave/

Simply run
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
and there you go!

from mitmproxy.

************ avatar ************ commented on May 17, 2024 6

Also try installing libxslt-dev: it solved it for me on Ubuntu as mentioned at: #218

from mitmproxy.

ynsgnr avatar ynsgnr commented on May 17, 2024 5

I know this is an old issue, but I've been experiencing a very similar one recently (though it was actually the Nokogiri Ruby gem that I was trying to install), and Googling brought me here.

I got past it by symlinking the Homebrew install of libxml2 to the usual include path:

sudo ln -s /usr/local/opt/libxml2/include/libxml2/libxml /usr/local/include/libxml

This might not be ideal for all situations, but works for me for now.

Solved for me on mojave libxml2 and libxlst installed with brew

from mitmproxy.

 avatar commented on May 17, 2024 3

I'm running into this as well.

"brew install libxml2" works:

==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libxml2-2.9

######################################################################## 100.0%

==> Pouring libxml2-2.9.1.mavericks.bottle.1.tar.gz

==> Caveats

This formula is keg-only, so it was not symlinked into /usr/local.


Mac OS X already provides this software and installing another version in

parallel can cause all kinds of trouble.


Generally there are no consequences of this for you. If you build your

own software and it requires this formula, you'll need to add to your

build variables:


    LDFLAGS:  -L/usr/local/opt/libxml2/lib

    CPPFLAGS: -I/usr/local/opt/libxml2/include


==> Summary

🍺  /usr/local/Cellar/libxml2/2.9.1: 274 files, 11M

but does not solve the problem:

$ STATIC_DEPS=true sudo pip install lxml

Downloading/unpacking lxml

  Downloading lxml-3.3.5.tar.gz (3.5MB): 3.5MB downloaded

  Running setup.py (path:/private/tmp/pip_build_root/lxml/setup.py) egg_info for package lxml
...
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -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/tmp/pip_build_root/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 -w -flat_namespace

    In file included from src/lxml/lxml.etree.c:346:

    /private/tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:9:10: fatal error: 'libxml/xmlversion.h' file not found

    #include "libxml/xmlversion.h"

             ^

    1 error generated.

    error: command 'cc' failed with exit status 1

from mitmproxy.

linkdesu avatar linkdesu commented on May 17, 2024 3

If you are MacOS , rerun xcode-select --install this problem may be fixed.

from mitmproxy.

cortesi avatar cortesi commented on May 17, 2024 2

Could you please try "brew install libxml2", and then re-run the pip install? Let me know if that fixes things.

from mitmproxy.

cxiaoer avatar cxiaoer commented on May 17, 2024 1

@************ it works for me, thanks!

from mitmproxy.

aratic avatar aratic commented on May 17, 2024 1

libxslt do works for freebsd v10.3, python27, here i try pip install lxml and got such error, thanks @************

from mitmproxy.

cortesi avatar cortesi commented on May 17, 2024

Hi there. You will need to install libxml in order to compile the Python bindings for this library. The easiest way to do this is to use brew.

I'm going to leave this ticket open, because I should address this in the installation docs.

from mitmproxy.

danielduhh avatar danielduhh commented on May 17, 2024

Im getting this exact error. How do I fix this. I tried to brew install libxml and got:
D-Baahs-MacBook-Pro:~ daniel-baah$ brew install libxml
Error: No available formula for libxml
Apple distributes libxml with OS X, you can find it in /usr/lib.
However not all build scripts look for these hard enough, so you may need
to call ENV.libxml2 in your formula's install function.

from mitmproxy.

 avatar commented on May 17, 2024

oops, that was the error from 'pip install lxml', which was another option we tried.

here's the error from 'sudo pip install mitmproxy':

$ sudo pip install mitmproxy
...
Downloading/unpacking lxml (from mitmproxy)

  Downloading lxml-3.3.5.tar.gz (3.5MB): 3.5MB downloaded

  Running setup.py (path:/private/tmp/pip_build_root/lxml/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.3.5.

    Building without Cython.

    Using build configuration of libxslt 1.1.28



    warning: no previously-included files found matching '*.py'
...
   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 -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/tmp/pip_build_root/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 -w -flat_namespace

    In file included from src/lxml/lxml.etree.c:346:

    /private/tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:9:10: fatal error: 'libxml/xmlversion.h' file not found

    #include "libxml/xmlversion.h"

             ^

    1 error generated.

    error: command 'cc' failed with exit status 1

    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-HYA4lj-record/install-record.txt --single-version-externally-managed --compile:

    /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.3.5.


Building without Cython.


Using build configuration of libxslt 1.1.28


running install


running build


running build_py


creating build


creating build/lib.macosx-10.9-intel-2.7


creating build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/__init__.py -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/_elementpath.py -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/builder.py -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/cssselect.py -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/doctestcompare.py -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/ElementInclude.py -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/pyclasslookup.py -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/sax.py -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/usedoctest.py -> build/lib.macosx-10.9-intel-2.7/lxml


creating build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/__init__.py -> build/lib.macosx-10.9-intel-2.7/lxml/includes


creating build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/__init__.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/_diffcommand.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/_html5builder.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/_setmixin.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/builder.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/clean.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/defs.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/diff.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/ElementSoup.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/formfill.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/html5parser.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/soupparser.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


copying src/lxml/html/usedoctest.py -> build/lib.macosx-10.9-intel-2.7/lxml/html


creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron


copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron


copying src/lxml/lxml.etree.h -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/lxml.etree_api.h -> build/lib.macosx-10.9-intel-2.7/lxml


copying src/lxml/includes/c14n.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/config.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/dtdvalid.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/etreepublic.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/htmlparser.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/relaxng.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/schematron.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/tree.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/uri.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/xinclude.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/xmlerror.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/xmlparser.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/xmlschema.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/xpath.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/xslt.pxd -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/etree_defs.h -> build/lib.macosx-10.9-intel-2.7/lxml/includes


copying src/lxml/includes/lxml-version.h -> build/lib.macosx-10.9-intel-2.7/lxml/includes


creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources


creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/rng


copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/rng


creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl


copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl


copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl


creating build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1


copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1


copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1


copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1


copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1


copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1


copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-10.9-intel-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1


running build_ext


building 'lxml.etree' extension


creating build/temp.macosx-10.9-intel-2.7


creating build/temp.macosx-10.9-intel-2.7/src


creating build/temp.macosx-10.9-intel-2.7/src/lxml


cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -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/tmp/pip_build_root/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 -w -flat_namespace


In file included from src/lxml/lxml.etree.c:346:


/private/tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:9:10: fatal error: 'libxml/xmlversion.h' file not found


#include "libxml/xmlversion.h"


         ^


1 error generated.


error: command 'cc' failed with exit status 1


----------------------------------------

Cleaning up...

Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-HYA4lj-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/lxml

from mitmproxy.

mcclayac avatar mcclayac commented on May 17, 2024

I am still having these problems. I have tried

  1. brew install libxml2
  2. pip install lxml ( Same Error : see below )
  3. sudo ln -s /usr/local/opt/libxml2/include/libxml2/libxml /usr/local/include/libxml

I still have this error on my Macbook Pro. Can anyone offer another suggestion?

$ brew list libxml2
/usr/local/Cellar/libxml2/2.9.4_3/bin/xml2-config
/usr/local/Cellar/libxml2/2.9.4_3/bin/xmlcatalog
/usr/local/Cellar/libxml2/2.9.4_3/bin/xmllint
/usr/local/Cellar/libxml2/2.9.4_3/include/libxml2/ (47 files)
/usr/local/Cellar/libxml2/2.9.4_3/lib/libxml2.2.dylib
/usr/local/Cellar/libxml2/2.9.4_3/lib/cmake/libxml2/libxml2-config.cmake
/usr/local/Cellar/libxml2/2.9.4_3/lib/pkgconfig/libxml-2.0.pc
/usr/local/Cellar/libxml2/2.9.4_3/lib/python2.7/ (4 files)
/usr/local/Cellar/libxml2/2.9.4_3/lib/ (3 other files)
/usr/local/Cellar/libxml2/2.9.4_3/share/aclocal/libxml.m4
/usr/local/Cellar/libxml2/2.9.4_3/share/doc/ (153 files)
/usr/local/Cellar/libxml2/2.9.4_3/share/gtk-doc/ (55 files)
/usr/local/Cellar/libxml2/2.9.4_3/share/man/ (4 files)

Error Message

cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /var/folders/mf/k3gwf7795b594fkvb64vbz_r0000gn/T/xmlXPathInitmvgtwwy3.c -o var/folders/mf/k3gwf7795b594fkvb64vbz_r0000gn/T/xmlXPathInitmvgtwwy3.o
/var/folders/mf/k3gwf7795b594fkvb64vbz_r0000gn/T/xmlXPathInitmvgtwwy3.c:1:10: fatal error: 'libxml/xpath.h' file not found
#include "libxml/xpath.h"
         ^
1 error generated.
*********************************************************************************
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
Perhaps try: xcode-select --install
*********************************************************************************
error: command '/usr/bin/clang' failed with exit status 1

from mitmproxy.

mhils avatar mhils commented on May 17, 2024

The latest mitmproxy release does not depend on lxml anymore.

from mitmproxy.

asahiko avatar asahiko commented on May 17, 2024

Simply run
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
and there you go!

If you couldn't find /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg in your system like me, go to https://developer.apple.com/download/more/ , log in, look for "Command Line Tools (macOS 10.14) for Xcode 10.x" (where 10.x is your Xcode version), download and install it. After installing that you'll find the pkg file in the aforementioned directory. Double-click on it to install.

from mitmproxy.

tibastral avatar tibastral commented on May 17, 2024

Simply run
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
and there you go!

If you couldn't find /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg in your system like me, go to https://developer.apple.com/download/more/ , log in, look for "Command Line Tools (macOS 10.14) for Xcode 10.x" (where 10.x is your Xcode version), download and install it. After installing that you'll find the pkg file in the aforementioned directory. Double-click on it to install.

Worked for me !

Thank you very much for that comment !!!

from mitmproxy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.