Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround: install lxml from binary wheel when unit tests run on MacOS #629

Merged
merged 15 commits into from Oct 12, 2022

Conversation

jayaddison
Copy link
Collaborator

@jayaddison jayaddison commented Oct 10, 2022

A pull request to attempt to narrow down on the version of Python 3.10.x where MacOS unit test failure noted at #628 (comment) bug could have been introduced.

Reading and comparing the 3.10.x and 3.11.x changelogs (since the failure affects both lineages) hasn't produced any definitive answers yet.

Problem identified: when lxml is installed from source on MacOS, it will link against the system-provided libxml2 at build-time. This appears to be the cause of the unit test failures we noticed, and this does not occur when using binary wheels from PyPy.

As a workaround, ensure that lxml is installed from binary wheel during MacOS unit test runs.

@jayaddison jayaddison force-pushed the issue-627/sidequest-macos-3.11.0-rc.1 branch from eaed1ba to b72e186 Compare October 10, 2022 19:43
@jayaddison jayaddison marked this pull request as ready for review October 10, 2022 19:45
@jayaddison jayaddison force-pushed the issue-627/sidequest-macos-3.11.0-rc.1 branch from b72e186 to 195d86d Compare October 10, 2022 19:46
@jayaddison jayaddison changed the base branch from issue-627/github-actions-unittests-os-fixup to main October 10, 2022 19:47
@jayaddison jayaddison force-pushed the issue-627/sidequest-macos-3.11.0-rc.1 branch from 195d86d to 3655803 Compare October 10, 2022 19:48
@jayaddison jayaddison marked this pull request as draft October 10, 2022 19:54
@jayaddison jayaddison force-pushed the issue-627/sidequest-macos-3.11.0-rc.1 branch from 799acbd to dbea462 Compare October 10, 2022 20:00
@jayaddison
Copy link
Collaborator Author

My guess is that this isn't a runtime issue; I think something's wrong with the lxml dependency installation.

Mon, 10 Oct 2022 21:40:51 GMT   Running setup.py install for lxml: still running...
Mon, 10 Oct 2022 21:41:51 GMT   Running setup.py install for lxml: still running...
Mon, 10 Oct 2022 21:41:54 GMT   Running setup.py install for lxml: finished with status 'done'

...and yet extruct is extracting nothing...

{'microdata': [], 'json-ld': []}

@jayaddison jayaddison force-pushed the issue-627/sidequest-macos-3.11.0-rc.1 branch from 4e9e7a8 to de3e786 Compare October 10, 2022 23:07
@jayaddison jayaddison changed the title Attempt to narrow down py3.10 / py3.11 unit test failure on MacOS Fix: unit tests fail in GitHub Actions for MacOS on Python 3.10 Oct 10, 2022
@jayaddison jayaddison changed the title Fix: unit tests fail in GitHub Actions for MacOS on Python 3.10 Workaround: install lxml from binary wheel when unit tests run on MacOS with Python 3.10 Oct 10, 2022
@jayaddison jayaddison marked this pull request as ready for review October 10, 2022 23:14
@jayaddison
Copy link
Collaborator Author

It seems that there is a behaviour change between (one of the versions of?) libxml2 shipped with some recent releases of MacOS and the behaviour of the library (or bindings?) when compiled during pip install lxml.

The binary wheel on PyPi -- which was statically compiled once and then uploaded for distribution -- appears to work. So we can use pip install --only-binary=lxml lxml to install that version for affected unit test runs.

Why doesn't this affect other versions of Python during unit testing? I'm unsure.

@jayaddison jayaddison marked this pull request as draft October 11, 2022 11:51
@jayaddison jayaddison changed the title Workaround: install lxml from binary wheel when unit tests run on MacOS with Python 3.10 Workaround: install lxml from binary wheel when unit tests run on MacOS Oct 12, 2022
@jayaddison jayaddison marked this pull request as ready for review October 12, 2022 10:23
@jayaddison
Copy link
Collaborator Author

Why doesn't this affect other versions of Python during unit testing? I'm unsure.

Also now noted in the pull request description, but for context here too: the reason that this only appeared to affect Python 3.10 and Python 3.11-rc.1 on MacOS was that binary wheels of lxml were not available for those version combinations.

So in fact, there wasn't necessarily a behaviour change introduced by either MacOS or Python. lxml built-from-source on Python 3.8 exhibits the same parsing problem.

@jayaddison jayaddison merged commit 401070d into main Oct 12, 2022
@jayaddison jayaddison deleted the issue-627/sidequest-macos-3.11.0-rc.1 branch October 12, 2022 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant