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

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

Open
Safranil opened this issue Dec 19, 2024 · 0 comments

Comments

@Safranil
Copy link

Describe the bug

After upgrading our installation to Debian 12, we encountered on error on uwsgi start:

Traceback (most recent call last):
  File "/home/pytition/www/pytition/pytition/pytition/wsgi.py", line 52, in <module>
    application = get_wsgi_application()
                  ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pytition/pytition_venv/lib/python3.11/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/home/pytition/pytition_venv/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/pytition/pytition_venv/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/home/pytition/pytition_venv/lib/python3.11/site-packages/django/apps/config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/pytition/www/pytition/pytition/petition/models.py", line 19, in <module>
    from .helpers import sanitize_html
  File "/home/pytition/www/pytition/pytition/petition/helpers.py", line 3, in <module>
    from lxml.html.clean import Cleaner
  File "/home/pytition/pytition_venv/lib/python3.11/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.

To Reproduce
I followed the installation guide to reinstall dependencies : https://pytition.readthedocs.io/en/stable/installation.html
And done the following:

  1. Changed directory to Pytition installation root
  2. rm -rf pytition_venv
  3. virtualenv -p python3 pytition_venv
  4. cd www/pytition
  5. source ../../pytition_venv/bin/activate
  6. pip3 install -r requirements.txt

To Resolve
To resolve the issue, I installed the now required dependency:

  1. source ../../pytition_venv/bin/activate
  2. pip3 install lxml_html_clean
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

1 participant