简体   繁体   中英

pip install lxml complains on clang

I'm aware that there are several quite similar topics, but each of them has unique clang traceback, and my case is not an exception.

My macOS version is Mojave 10.14.2. I have command line tools installed, $ echo $C_INCLUDE_PATH outputs /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include

So i'm trying to install lxml via pip install lxml , and getting the following traceback:

Running setup.py bdist_wheel for lxml ... error
  Complete output from command /Users/bulrathi/Virtualenvs/gm-test/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T/pip-install-8a1v9j7p/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T/pip-wheel-wpeizpmd --python-tag cp37:
  Building lxml version 3.6.0.
  Building without Cython.
  Using build configuration of libxslt 1.1.29
  Building against libxml2/libxslt in the following directory: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.14-x86_64-3.7
  creating build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/_elementpath.py -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/sax.py -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/pyclasslookup.py -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/builder.py -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/doctestcompare.py -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/usedoctest.py -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/cssselect.py -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/ElementInclude.py -> build/lib.macosx-10.14-x86_64-3.7/lxml
  creating build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  creating build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/soupparser.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/defs.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/_setmixin.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/clean.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/_diffcommand.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/html5parser.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/formfill.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/builder.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/ElementSoup.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/_html5builder.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/usedoctest.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  copying src/lxml/html/diff.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/html
  creating build/lib.macosx-10.14-x86_64-3.7/lxml/isoschematron
  copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-10.14-x86_64-3.7/lxml/isoschematron
  copying src/lxml/lxml.etree.h -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/lxml.etree_api.h -> build/lib.macosx-10.14-x86_64-3.7/lxml
  copying src/lxml/includes/xmlerror.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/c14n.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/xmlschema.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/schematron.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/tree.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/uri.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/etreepublic.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/xpath.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/htmlparser.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/xslt.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/config.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/xmlparser.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/xinclude.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/dtdvalid.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/relaxng.pxd -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/lxml-version.h -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  copying src/lxml/includes/etree_defs.h -> build/lib.macosx-10.14-x86_64-3.7/lxml/includes
  creating build/lib.macosx-10.14-x86_64-3.7/lxml/isoschematron/resources
  creating build/lib.macosx-10.14-x86_64-3.7/lxml/isoschematron/resources/rng
  copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-10.14-x86_64-3.7/lxml/isoschematron/resources/rng
  creating build/lib.macosx-10.14-x86_64-3.7/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-10.14-x86_64-3.7/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-10.14-x86_64-3.7/lxml/isoschematron/resources/xsl
  creating build/lib.macosx-10.14-x86_64-3.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.14-x86_64-3.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.14-x86_64-3.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.14-x86_64-3.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.14-x86_64-3.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.14-x86_64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-10.14-x86_64-3.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  running build_ext
  building 'lxml.etree' extension
  creating build/temp.macosx-10.14-x86_64-3.7
  creating build/temp.macosx-10.14-x86_64-3.7/src
  creating build/temp.macosx-10.14-x86_64-3.7/src/lxml
  clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2 -Isrc/lxml/includes -I/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c src/lxml/lxml.etree.c -o build/temp.macosx-10.14-x86_64-3.7/src/lxml/lxml.etree.o -w -flat_namespace
  src/lxml/lxml.etree.c:220873:21: error: no member named 'exc_type' in 'struct _ts'
      *type = tstate->exc_type;
              ~~~~~~  ^
  src/lxml/lxml.etree.c:220874:22: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      *value = tstate->exc_value;
                       ^~~~~~~~~
                       curexc_value
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:240:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  src/lxml/lxml.etree.c:220875:19: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      *tb = tstate->exc_traceback;
                    ^~~~~~~~~~~~~
                    curexc_traceback
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:241:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  src/lxml/lxml.etree.c:220887:24: error: no member named 'exc_type' in 'struct _ts'
      tmp_type = tstate->exc_type;
                 ~~~~~~  ^
  src/lxml/lxml.etree.c:220888:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tmp_value = tstate->exc_value;
                          ^~~~~~~~~
                          curexc_value
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:240:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  src/lxml/lxml.etree.c:220889:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tmp_tb = tstate->exc_traceback;
                       ^~~~~~~~~~~~~
                       curexc_traceback
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:241:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  src/lxml/lxml.etree.c:220890:13: error: no member named 'exc_type' in 'struct _ts'
      tstate->exc_type = type;
      ~~~~~~  ^
  src/lxml/lxml.etree.c:220891:13: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tstate->exc_value = value;
              ^~~~~~~~~
              curexc_value
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:240:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  src/lxml/lxml.etree.c:220892:13: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tstate->exc_traceback = tb;
              ^~~~~~~~~~~~~
              curexc_traceback
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:241:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  src/lxml/lxml.etree.c:220935:24: error: no member named 'exc_type' in 'struct _ts'
      tmp_type = tstate->exc_type;
                 ~~~~~~  ^
  src/lxml/lxml.etree.c:220936:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tmp_value = tstate->exc_value;
                          ^~~~~~~~~
                          curexc_value
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:240:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  src/lxml/lxml.etree.c:220937:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tmp_tb = tstate->exc_traceback;
                       ^~~~~~~~~~~~~
                       curexc_traceback
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:241:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  src/lxml/lxml.etree.c:220938:13: error: no member named 'exc_type' in 'struct _ts'
      tstate->exc_type = local_type;
      ~~~~~~  ^
  src/lxml/lxml.etree.c:220939:13: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tstate->exc_value = local_value;
              ^~~~~~~~~
              curexc_value
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:240:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  src/lxml/lxml.etree.c:220940:13: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tstate->exc_traceback = local_tb;
              ^~~~~~~~~~~~~
              curexc_traceback
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:241:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  src/lxml/lxml.etree.c:221249:24: error: no member named 'exc_type' in 'struct _ts'
      tmp_type = tstate->exc_type;
                 ~~~~~~  ^
  src/lxml/lxml.etree.c:221250:25: error: no member named 'exc_value' in 'struct _ts'; did you mean 'curexc_value'?
      tmp_value = tstate->exc_value;
                          ^~~~~~~~~
                          curexc_value
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:240:15: note: 'curexc_value' declared here
      PyObject *curexc_value;
                ^
  src/lxml/lxml.etree.c:221251:22: error: no member named 'exc_traceback' in 'struct _ts'; did you mean 'curexc_traceback'?
      tmp_tb = tstate->exc_traceback;
                       ^~~~~~~~~~~~~
                       curexc_traceback
  /usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/include/python3.7m/pystate.h:241:15: note: 'curexc_traceback' declared here
      PyObject *curexc_traceback;
                ^
  src/lxml/lxml.etree.c:221252:13: error: no member named 'exc_type' in 'struct _ts'
      tstate->exc_type = *type;
      ~~~~~~  ^
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  Compile failed: command 'clang' failed with exit status 1
  creating var
  creating var/folders
  creating var/folders/4n
  creating var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn
  creating var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T
  cc -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2 -I/usr/include/libxml2 -c /var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T/xmlXPathIniti_lemcx7.c -o var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T/xmlXPathIniti_lemcx7.o
  /var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T/xmlXPathIniti_lemcx7.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
  main (int argc, char **argv) {
  ^
  1 warning generated.
  cc var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T/xmlXPathIniti_lemcx7.o -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib -lxml2 -o a.out
  error: command 'clang' failed with exit status 1

  ----------------------------------------
  Failed building wheel for lxml

Command "/Users/bulrathi/Virtualenvs/gm-test/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T/pip-install-0tja2284/lxml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T/pip-record-w1eydfb_/install-record.txt --single-version-externally-managed --compile --install-headers /Users/bulrathi/Virtualenvs/gm-test/bin/../include/site/python3.7/lxml" failed with error code 1 in /private/var/folders/4n/brsfjpqx0kz8lh4rdcz6nb0w0000gn/T/pip-install-0tja2284/lxml/

Can you please help?

The problem is that I've tried to install lxml==3.6.0 from requirements.txt having python3.7.0 on my system. lxml3.6.0 is incompatible with python3.7.0, please consider to use lxml>4.0. Thank you, @hoefling!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM