Charlie Clark schrieb am 22.02.22 um 09:48:
On 21 Feb 2022, at 20:37, Jens Tröger wrote:
Yes, when I installed lxml it built locally on my Intel Mac 10.14.6 with Python 3.9.10, and in another email I actually wanted to ask for a pre-compiled whl:

Collecting lxml

Using cached lxml-4.8.0.tar.gz (3.2 MB)

Using legacy 'setup.py install' for lxml, since package 'wheel' is not installed.

Installing collected packages: lxml

Running setup.py install for lxml ... done

Successfully installed lxml-4.8.0

FWIW I can confirm that this happens if lxml is built on the machine but not with the wheel

This is locally build lxml

Python              : sys.version_info(major=3, minor=9, micro=10, releaselevel='final', serial=0)
lxml.etree          : (4, 8, 0, 0)
libxml used         : (2, 9, 12)
libxml compiled     : (2, 9, 12)
libxslt used        : (1, 1, 34)
libxslt compiled    : (1, 1, 34)
3
<Element b at 0x103815a00> b'<b id="b-1">\n    <c id="b-1-c">baz</c>\n </b>\n  <b id="b-2">\n    <c id="b-2-c">baz</c>\n  </b>\n  <b id="b-3">\n    <c id="b-3-c">baz</c>\n  </b>\n</a>\n  ' <Element b at 0x103815a40> b'<b id="b-2">\n    <c id="b-2-c">baz</c>\n </b>\n  <b id="b-3">\n    <c id="b-3-c">baz</c>\n  </b>\n</a>\n  ' <Element b at 0x103815a80> b'<b id="b-3">\n    <c id="b-3-c">baz</c>\n </b>\n</a>\n'

And this with the wheel

Python              : sys.version_info(major=3, minor=9, micro=10, releaselevel='final', serial=0)
lxml.etree          : (4, 8, 0, 0)
libxml used         : (2, 9, 12)
libxml compiled     : (2, 9, 12)
libxslt used        : (1, 1, 34)
libxslt compiled    : (1, 1, 34)
3
<Element b at 0x101b1b9c0> b'<b id="b-1">\n    <c id="b-1-c">baz</c>\n </b>\n  ' <Element b at 0x101b1ba00> b'<b id="b-2">\n    <c id="b-2-c">baz</c>\n </b>\n  '
<Element b at 0x101b1ba40> b'<b id="b-3">\n    <c id="b-3-c">baz</c>\n </b>\n'

All libraries have the same version so it must be something else. I use MacPorts to keep libraries up to date.

Sadly, libxml2 2.9.12 is not libxml2 2.9.12 here. On your machine, you probably have the latest release version installed. The lxml wheels are built with a newer git version that has a fix for this issue. Or a work-around, if you want.

If you set STATIC_BUILD=true, and LIBXML_VERSION=2.9.12, lxml will use the git version instead of the release version.

It would probably be worth adding a runtime detection for this issue, so that lxml can fail to import if it finds an incompatible libxml2 version. The broken behaviour seems heavy enough to fail hard instead of issuing just a warning (which the build currently does, but you normally won't see that in pip installations).

Stefan
_______________________________________________
lxml - The Python XML Toolkit mailing list -- lxml@python.org
To unsubscribe send an email to lxml-le...@python.org
https://mail.python.org/mailman3/lists/lxml.python.org/
Member address: arch...@mail-archive.com

Reply via email to