Search code examples
pythonhtmlxmlreadability

Trying to install readability python API and I can not import it


After installing the package, I enter the python environment. I am new to python so I import the modules that I need however, this one fails to import. Can someone help me fix it.

>>> import readability
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/readability/__init__.py", line 1, in <module>
    from .readability import Document
  File "/usr/local/lib/python2.7/dist-packages/readability/readability.py", line 2, in <module>
    from cleaners import html_cleaner, clean_attributes
  File "/usr/local/lib/python2.7/dist-packages/readability/cleaners.py", line 3, in <module>
    from lxml.html.clean import Cleaner
ImportError: No module named lxml.html.clean

I really need this module to work. I am under the impression that this is the same module used http://www.readability.com/ and in apples safari read protocol.


Solution

  • You probably don't have lxml installed. You can download and install it by following these instructions: http://lxml.de/installation.html