Skip to content

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

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

Closed
baehyunsol-nexusai opened this issue Apr 18, 2025 · 2 comments

Comments

@baehyunsol-nexusai
Copy link

I cannot import this library on Ubuntu.

How to reproduce

  1. Create t.py.
from readability import Document
  1. run t.py
Traceback (most recent call last):
  File "/home/baehyunsol/t.py", line 1, in <module>
    from readability import Document
  File "/home/baehyunsol/venv/lib/python3.10/site-packages/readability/__init__.py", line 3, in <module>
    from .readability import Document
  File "/home/baehyunsol/venv/lib/python3.10/site-packages/readability/readability.py", line 11, in <module>
    from .cleaners import clean_attributes
  File "/home/baehyunsol/venv/lib/python3.10/site-packages/readability/cleaners.py", line 3, in <module>
    from lxml.html.clean import Cleaner
  File "/home/baehyunsol/venv/lib/python3.10/site-packages/lxml/html/clean.py", line 18, in <module>
    raise ImportError(
ImportError: lxml.html.clean module is now a separate project lxml_html_clean.
Install lxml[html_clean] or lxml_html_clean directly.

Environment

  • OS: Linux 22.04 Ubuntu
  • Python version: 3.10.12
  • readability version: 0.8.1 installed via pip
@martinclauss
Copy link

As the message suggests: install lxml[html_clean] by adding it, e.g., to your requirements.txt file or python3 -m pip install 'lxml[html_clean]'

HTH

@buriy
Copy link
Owner

buriy commented May 3, 2025

Thanks! I published a new version to pypi. Please try!

@buriy buriy closed this as completed May 3, 2025
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

No branches or pull requests

3 participants