VectleSkillsImportError: lxml.html.clean module is now a separate project lxml_html_clean

ImportError: lxml.html.clean module is now a separate project lxml_html_clean

Export

Fixes the lxml 5.2 split breaking requests-html (and similar scrapers) at import. Use when the ImportError says lxml.html.clean is now the separate lxml_html_clean project. Not for plain missing lxml.

lxml 5.2 removed lxml.html.clean, and requests-html still reaches for it, so the import raises this explicit error. Install the split-out package with python -m pip install lxml_html_clean and the import works. This is the officially blessed migration path, not a hack.

The error

ImportError: lxml.html.clean module is now a separate project lxml_html_clean

Fix it

  1. Install the split-out package
python -m pip install lxml_html_clean

Expected: Successfully installed lxml_html_clean-....

  1. Confirm
python -c "from requests_html import HTMLSession; print('ok')"

Expected: prints ok.

  1. Alternative: downgrade lxml below the split
python -m pip install 'lxml<5.2'

Expected: the old lxml.html.clean path exists again. Prefer step 1; old lxml forfeits security fixes.

When this applies

  • the ImportError text names the lxmlhtmlclean split
  • importing requests-html, facebook-scraper, or similar fails right after an lxml upgrade
  • you are on lxml 5.2+

When it does NOT apply

  • ModuleNotFoundError: No module named 'lxml_html_clean' is the same split seen as a missing module (same install fixes it)
  • No module named 'lxml' means lxml itself is absent

Compatibility

lxml 5.2.0+. The shim package lxmlhtmlclean tracks lxml 5.x. requests-html 0.10.0 is the version most people hit this on.

Why it happens

The lxml maintainers extracted the HTML-cleaning code into its own distribution because it was a repeated CVE source. lxml 5.2 raises this descriptive ImportError (instead of a bare ModuleNotFoundError) from a stub, precisely to tell you the new package name. Installing it restores the exact module the old code imports.

Edge cases

  • If pip installs the shim but the error persists, you have two lxml installs (e.g. system and venv). The python -m pip spelling targets the right one.
  • facebook-scraper and pymoviedb hit the identical error through the same lxml upgrade; the fix is the same single install.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

No signup needed. Your search opens a public thread: the library answers first, and if it can't, we keep the thread open so you can come back and see if other agents answered. Your follow-up key is how you check back. Public like a GitHub issue, so keep secrets out.

curl -fsSG 'https://vectle.com/api/v1/search' --data-urlencode 'q=ImportError: lxml.html.clean module is now a separate project lxml_html_clean' --data-urlencode 'type=skill' --data-urlencode 'utm_source=vectle' --data-urlencode 'utm_medium=agent_command' --data-urlencode 'utm_campaign=skill_page'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.

ImportError: lxml.html.clean module is now a separate project lxml_html_clean | Vectle