skip to Main Content

I’m trying to install some dependencies from a requiremnents.txt file and I’m getting the error shown below.
I’m using a MacOS 13.3, on a M2 chip MacBook Pro. Running Python 3.11.3 on a venv

However, if I try to import lxml on a Python script, it works just fine. Also when I try pip install lxml, it says it is already installed.
I’ve already tried a bunch of possible fixes I found online, but I didn’t manage to get that fixed.

Did anyone manage to fix this issue? Or have any ideas to try out?

Building wheels for collected packages: lxml
  Building wheel for lxml (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [145 lines of output]
      Building lxml version 4.6.5.
      Building without Cython.
      Building against libxml2 2.9.13 and libxslt 1.1.35
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-311
      creating build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/_elementpath.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/sax.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/pyclasslookup.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/__init__.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/builder.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/doctestcompare.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/usedoctest.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/cssselect.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/ElementInclude.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      creating build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/__init__.py -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      creating build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/soupparser.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/defs.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/_setmixin.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/clean.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/_diffcommand.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/html5parser.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/__init__.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/formfill.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/builder.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/ElementSoup.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/_html5builder.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/usedoctest.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/diff.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron
      copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron
      copying src/lxml/etree.h -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/etree_api.h -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/lxml.etree.h -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/lxml.etree_api.h -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/includes/xmlerror.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/c14n.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlschema.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/__init__.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/schematron.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/tree.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/uri.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/etreepublic.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xpath.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/htmlparser.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xslt.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/config.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlparser.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xinclude.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/dtdvalid.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/relaxng.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/lxml-version.h -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/etree_defs.h -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/rng
      copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/rng
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl
      copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl
      copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.macosx-13-arm64-cpython-311/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-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build/temp.macosx-13-arm64-cpython-311
      creating build/temp.macosx-13-arm64-cpython-311/src
      creating build/temp.macosx-13-arm64-cpython-311/src/lxml
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/opt/homebrew/opt/postgresql@15/include -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/Users/cauenapier/Documents/GitHub/vali/backend/myenv/include -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/lxml/etree.c -o build/temp.macosx-13-arm64-cpython-311/src/lxml/etree.o -w -flat_namespace
      src/lxml/etree.c:261877:23: error: no member named 'exc_type' in 'struct _err_stackitem'
          while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
                  ~~~~~~~~  ^
      src/lxml/etree.c:261877:53: error: no member named 'exc_type' in 'struct _err_stackitem'
          while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
                                                ~~~~~~~~  ^
      src/lxml/etree.c:261891:23: error: no member named 'exc_type' in 'struct _err_stackitem'
          *type = exc_info->exc_type;
                  ~~~~~~~~  ^
      src/lxml/etree.c:261893:21: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          *tb = exc_info->exc_traceback;
                ~~~~~~~~  ^
      src/lxml/etree.c:261907:26: error: no member named 'exc_type' in 'struct _err_stackitem'
          tmp_type = exc_info->exc_type;
                     ~~~~~~~~  ^
      src/lxml/etree.c:261909:24: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          tmp_tb = exc_info->exc_traceback;
                   ~~~~~~~~  ^
      src/lxml/etree.c:261910:15: error: no member named 'exc_type' in 'struct _err_stackitem'
          exc_info->exc_type = type;
          ~~~~~~~~  ^
      src/lxml/etree.c:261912:15: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          exc_info->exc_traceback = tb;
          ~~~~~~~~  ^
      src/lxml/etree.c:261994:30: error: no member named 'exc_type' in 'struct _err_stackitem'
              tmp_type = exc_info->exc_type;
                         ~~~~~~~~  ^
      src/lxml/etree.c:261996:28: error: no member named 'exc_traceback' in 'struct _err_stackitem'
              tmp_tb = exc_info->exc_traceback;
                       ~~~~~~~~  ^
      src/lxml/etree.c:261997:19: error: no member named 'exc_type' in 'struct _err_stackitem'
              exc_info->exc_type = local_type;
              ~~~~~~~~  ^
      src/lxml/etree.c:261999:19: error: no member named 'exc_traceback' in 'struct _err_stackitem'
              exc_info->exc_traceback = local_tb;
              ~~~~~~~~  ^
      src/lxml/etree.c:262185:26: error: no member named 'exc_type' in 'struct _err_stackitem'
          tmp_type = exc_info->exc_type;
                     ~~~~~~~~  ^
      src/lxml/etree.c:262187:24: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          tmp_tb = exc_info->exc_traceback;
                   ~~~~~~~~  ^
      src/lxml/etree.c:262188:15: error: no member named 'exc_type' in 'struct _err_stackitem'
          exc_info->exc_type = *type;
          ~~~~~~~~  ^
      src/lxml/etree.c:262190:15: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          exc_info->exc_traceback = *tb;
          ~~~~~~~~  ^
      src/lxml/etree.c:264391:20: error: no member named 'exc_type' in 'struct _err_stackitem'
          t = exc_state->exc_type;
              ~~~~~~~~~  ^
      src/lxml/etree.c:264393:21: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          tb = exc_state->exc_traceback;
               ~~~~~~~~~  ^
      src/lxml/etree.c:264394:16: error: no member named 'exc_type' in 'struct _err_stackitem'
          exc_state->exc_type = NULL;
          ~~~~~~~~~  ^
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      20 errors generated.
      Compile failed: command '/usr/bin/clang' failed with exit code 1
      creating var
      creating var/folders
      creating var/folders/6c
      creating var/folders/6c/d_lf625x5zn52yd5ytr2rf1c0000gn
      creating var/folders/6c/d_lf625x5zn52yd5ytr2rf1c0000gn/T
      cc -I/usr/include/libxml2 -c /var/folders/6c/d_lf625x5zn52yd5ytr2rf1c0000gn/T/xmlXPathInitlj7j8147.c -o var/folders/6c/d_lf625x5zn52yd5ytr2rf1c0000gn/T/xmlXPathInitlj7j8147.o
      cc var/folders/6c/d_lf625x5zn52yd5ytr2rf1c0000gn/T/xmlXPathInitlj7j8147.o -lxml2 -o a.out
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lxml
  Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: sentry-sdk, pbr, oauthlib, lxml, jmespath, isodate, imgkit, hyperlink, hyperframe, hpack, hiredis, h11, gunicorn, future, et-xmlfile, entrypoints, docutils, django-timezone-field, django-simple-history, django-ipware, django-constance, Django, click-plugins, click-didyoumean, beautifulsoup4, Automat, async-timeout, apache-age-python, amqp, xmlsec, wsproto, uvicorn, uncertainties, twisted, redis, rdflib, python-crontab, openpyxl, mailchimp3, m2r2, kombu, h2, djangorestframework, django-storages, django-slack, django-rest-hooks, django-polymorphic, django-picklefield, django-oauth-toolkit, django-jsonfield, django-js-asset, django-inline-actions, django-health-check, django-filter, django-currentuser, django-cors-headers, django-axes, django-annoying, coreschema, click-repl, botocore, aioredis, sorl-thumbnail-serializer-field, service-identity, s3transfer, python3-saml, pyopenssl, pyexcel-xlsx, ipython, hypercorn, djangorestframework-filters, djangorestframework-csv, django-rest-auth, django-redis, django-mptt, coreapi, celery, autobahn, nbconvert, drf-yasg, django-celery-beat, boto3, daphne, channels, channels_redis
  Attempting uninstall: pbr
    Found existing installation: pbr 1.6.0
    Uninstalling pbr-1.6.0:
      Successfully uninstalled pbr-1.6.0
  Attempting uninstall: oauthlib
    Found existing installation: oauthlib 3.2.2
    Uninstalling oauthlib-3.2.2:
      Successfully uninstalled oauthlib-3.2.2
  Attempting uninstall: lxml
    Found existing installation: lxml 4.9.2
    Uninstalling lxml-4.9.2:
      Successfully uninstalled lxml-4.9.2
  Running setup.py install for lxml ... error
  error: subprocess-exited-with-error

  × Running setup.py install for lxml did not run successfully.
  │ exit code: 1
  ╰─> [142 lines of output]
      Building lxml version 4.6.5.
      Building without Cython.
      Building against libxml2 2.9.13 and libxslt 1.1.35
      running install
      /Users/cauenapier/Documents/GitHub/vali/backend/myenv/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_py
      creating build
      creating build/lib.macosx-13-arm64-cpython-311
      creating build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/_elementpath.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/sax.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/pyclasslookup.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/__init__.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/builder.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/doctestcompare.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/usedoctest.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/cssselect.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/ElementInclude.py -> build/lib.macosx-13-arm64-cpython-311/lxml
      creating build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/__init__.py -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      creating build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/soupparser.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/defs.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/_setmixin.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/clean.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/_diffcommand.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/html5parser.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/__init__.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/formfill.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/builder.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/ElementSoup.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/_html5builder.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/usedoctest.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      copying src/lxml/html/diff.py -> build/lib.macosx-13-arm64-cpython-311/lxml/html
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron
      copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron
      copying src/lxml/etree.h -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/etree_api.h -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/lxml.etree.h -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/lxml.etree_api.h -> build/lib.macosx-13-arm64-cpython-311/lxml
      copying src/lxml/includes/xmlerror.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/c14n.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlschema.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/__init__.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/schematron.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/tree.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/uri.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/etreepublic.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xpath.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/htmlparser.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xslt.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/config.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xmlparser.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/xinclude.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/dtdvalid.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/relaxng.pxd -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/lxml-version.h -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      copying src/lxml/includes/etree_defs.h -> build/lib.macosx-13-arm64-cpython-311/lxml/includes
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/rng
      copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/rng
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl
      copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl
      copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl
      creating build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.macosx-13-arm64-cpython-311/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-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-13-arm64-cpython-311/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
      running build_ext
      building 'lxml.etree' extension
      creating build/temp.macosx-13-arm64-cpython-311
      creating build/temp.macosx-13-arm64-cpython-311/src
      creating build/temp.macosx-13-arm64-cpython-311/src/lxml
      clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk -I/opt/homebrew/opt/postgresql@15/include -DCYTHON_CLINE_IN_TRACEBACK=0 -Isrc -Isrc/lxml/includes -I/Users/cauenapier/Documents/GitHub/vali/backend/myenv/include -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c src/lxml/etree.c -o build/temp.macosx-13-arm64-cpython-311/src/lxml/etree.o -w -flat_namespace
      src/lxml/etree.c:261877:23: error: no member named 'exc_type' in 'struct _err_stackitem'
          while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
                  ~~~~~~~~  ^
      src/lxml/etree.c:261877:53: error: no member named 'exc_type' in 'struct _err_stackitem'
          while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
                                                ~~~~~~~~  ^
      src/lxml/etree.c:261891:23: error: no member named 'exc_type' in 'struct _err_stackitem'
          *type = exc_info->exc_type;
                  ~~~~~~~~  ^
      src/lxml/etree.c:261893:21: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          *tb = exc_info->exc_traceback;
                ~~~~~~~~  ^
      src/lxml/etree.c:261907:26: error: no member named 'exc_type' in 'struct _err_stackitem'
          tmp_type = exc_info->exc_type;
                     ~~~~~~~~  ^
      src/lxml/etree.c:261909:24: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          tmp_tb = exc_info->exc_traceback;
                   ~~~~~~~~  ^
      src/lxml/etree.c:261910:15: error: no member named 'exc_type' in 'struct _err_stackitem'
          exc_info->exc_type = type;
          ~~~~~~~~  ^
      src/lxml/etree.c:261912:15: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          exc_info->exc_traceback = tb;
          ~~~~~~~~  ^
      src/lxml/etree.c:261994:30: error: no member named 'exc_type' in 'struct _err_stackitem'
              tmp_type = exc_info->exc_type;
                         ~~~~~~~~  ^
      src/lxml/etree.c:261996:28: error: no member named 'exc_traceback' in 'struct _err_stackitem'
              tmp_tb = exc_info->exc_traceback;
                       ~~~~~~~~  ^
      src/lxml/etree.c:261997:19: error: no member named 'exc_type' in 'struct _err_stackitem'
              exc_info->exc_type = local_type;
              ~~~~~~~~  ^
      src/lxml/etree.c:261999:19: error: no member named 'exc_traceback' in 'struct _err_stackitem'
              exc_info->exc_traceback = local_tb;
              ~~~~~~~~  ^
      src/lxml/etree.c:262185:26: error: no member named 'exc_type' in 'struct _err_stackitem'
          tmp_type = exc_info->exc_type;
                     ~~~~~~~~  ^
      src/lxml/etree.c:262187:24: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          tmp_tb = exc_info->exc_traceback;
                   ~~~~~~~~  ^
      src/lxml/etree.c:262188:15: error: no member named 'exc_type' in 'struct _err_stackitem'
          exc_info->exc_type = *type;
          ~~~~~~~~  ^
      src/lxml/etree.c:262190:15: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          exc_info->exc_traceback = *tb;
          ~~~~~~~~  ^
      src/lxml/etree.c:264391:20: error: no member named 'exc_type' in 'struct _err_stackitem'
          t = exc_state->exc_type;
              ~~~~~~~~~  ^
      src/lxml/etree.c:264393:21: error: no member named 'exc_traceback' in 'struct _err_stackitem'
          tb = exc_state->exc_traceback;
               ~~~~~~~~~  ^
      src/lxml/etree.c:264394:16: error: no member named 'exc_type' in 'struct _err_stackitem'
          exc_state->exc_type = NULL;
          ~~~~~~~~~  ^
      fatal error: too many errors emitted, stopping now [-ferror-limit=]
      20 errors generated.
      Compile failed: command '/usr/bin/clang' failed with exit code 1
      cc -I/usr/include/libxml2 -c /var/folders/6c/d_lf625x5zn52yd5ytr2rf1c0000gn/T/xmlXPathInit9owg448l.c -o var/folders/6c/d_lf625x5zn52yd5ytr2rf1c0000gn/T/xmlXPathInit9owg448l.o
      cc var/folders/6c/d_lf625x5zn52yd5ytr2rf1c0000gn/T/xmlXPathInit9owg448l.o -lxml2 -o a.out
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  Rolling back uninstall of lxml
  Moving to /Users/cauenapier/Documents/GitHub/vali/backend/myenv/lib/python3.11/site-packages/lxml-4.9.2.dist-info/
   from /Users/cauenapier/Documents/GitHub/vali/backend/myenv/lib/python3.11/site-packages/~xml-4.9.2.dist-info
  Moving to /Users/cauenapier/Documents/GitHub/vali/backend/myenv/lib/python3.11/site-packages/lxml/
   from /Users/cauenapier/Documents/GitHub/vali/backend/myenv/lib/python3.11/site-packages/~xml
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lxml

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

2

Answers


  1. Chosen as BEST ANSWER

    Today I have updated MacOS and the problem simply disappeared!


  2. You can update the version of the Xcode Command Line Tools installed, instead of update the MacOS. You can do it by running the following command in your terminal:

    xcode-select --install
    

    And then instal lxml:

    pip install lxml
    

    If you have previously installed "lxml" using Homebrew, you might want to try uninstalling it first.
    I didn’t and it still worked, but just to let you know how to do it:

    brew uninstall --ignore-dependencies lxml
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search