AttributeError: module ‘lxml.html.clean’ has no attribute ‘defs’ on Odoo 17

I get an error when installing lxml on an Odor 17 project in MacBook M1 chip.
First of all, when installing requirements.txt, an error occurred. So I commented out some lines in the requirements.txt file.

...
#greenlet==1.1.2 ; python_version == '3.10'  # (Jammy)
#greenlet==2.0.2 ; python_version > '3.10'
...
#lxml==4.8.0 ; python_version <= '3.10'
#lxml==4.9.2 ; python_version > '3.10'
...
#reportlab==3.6.8 ; python_version <= '3.10'
#reportlab==3.6.12 ; python_version > '3.10'
...

After installing all package, I try to install manually those packages.

I was able to install greenlet and reportlab packages but, not lxml package.

After a few Google searches, I found this link: https://www.odoo.com/forum/help-1/odoo-17-install-bug-attributeerror-module-lxml-html-clean-has-no-attribute-defs-249918

According this link, the problem is due to lxml version.
So I try to install lxml 4.8.0 version (pip3 install lxml==4.8.0). But I get an other error. Then I ron pip3 install lxml and lxml 5.2.1 was been installed.

When running Odoo project I PyCharm, this error occurred:

Traceback (most recent call last):
  File "/Users/youstra/odoo-server/odoo-bin", line 5, in <module>
    import odoo
  File "/Users/youstra/odoo-server/odoo/__init__.py", line 134, in <module>
    from . import modules
  File "/Users/youstra/odoo-server/odoo/modules/__init__.py", line 8, in <module>
    from . import db, graph, loading, migration, module, registry, neutralize
  File "/Users/youstra/odoo-server/odoo/modules/graph.py", line 11, in <module>
    import odoo.tools as tools
  File "/Users/youstra/odoo-server/odoo/tools/__init__.py", line 24, in <module>
    from .mail import *
  File "/Users/youstra/odoo-server/odoo/tools/mail.py", line 19, in <module>
    from lxml.html import clean
  File "/Users/youstra/odoo-server/venv/lib/python3.12/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.

When I try pip3 install lxml[html_clean] command, I get on command prompt
zsh: no matches found: lxml[html_clean].

So I try to install lxml_html_clean and the installation was successfully done.

But after this installation, I tried to run Odoo project and I got this error:

Traceback (most recent call last):
  File "/Users/youstra/odoo-server/odoo-bin", line 5, in <module>
    import odoo
  File "/Users/youstra/odoo-server/odoo/__init__.py", line 134, in <module>
    from . import modules
  File "/Users/youstra/odoo-server/odoo/modules/__init__.py", line 8, in <module>
    from . import db, graph, loading, migration, module, registry, neutralize
  File "/Users/youstra/odoo-server/odoo/modules/graph.py", line 11, in <module>
    import odoo.tools as tools
  File "/Users/youstra/odoo-server/odoo/tools/__init__.py", line 24, in <module>
    from .mail import *
  File "/Users/youstra/odoo-server/odoo/tools/mail.py", line 32, in <module>
    safe_attrs = clean.defs.safe_attrs | frozenset(
                 ^^^^^^^^^^
AttributeError: module 'lxml.html.clean' has no attribute 'defs'

I don’t know what can I do to solve this issue.

I’m a new Odoo and Python developper.

Thanks a lot of

  • Python version: 3.12
  • Odoo version: 17
  • iOS version: Sonoma

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật