Migrate site to v11 and html5lib error - object has no attribute '_base'

Error as a title
When migrate my site to V11 staging, receive this error

Traceback (most recent call last):
  File "/usr/lib64/python2.7/runpy.py", line 151, in _run_module_as_main
    mod_name, loader, code, fname = _get_module_details(mod_name)
  File "/usr/lib64/python2.7/runpy.py", line 101, in _get_module_details
    loader = get_loader(mod_name)
  File "/usr/lib64/python2.7/pkgutil.py", line 464, in get_loader
    return find_loader(fullname)
  File "/usr/lib64/python2.7/pkgutil.py", line 474, in find_loader
    for importer in iter_importers(fullname):
  File "/usr/lib64/python2.7/pkgutil.py", line 430, in iter_importers
    __import__(pkg)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 18, in <module>
    from .utils.jinja import (get_jenv, get_template, render_template, get_email_from_template, get_jloader)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/__init__.py", line 9, in <module>
    from .html_utils import sanitize_html
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/html_utils.py", line 5, in <module>
    from bs4 import BeautifulSoup
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/bs4/__init__.py", line 30, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/bs4/builder/__init__.py", line 314, in <module>
    from . import _html5lib
  File "/home/frappe/frappe-bench/env/lib/python2.7/site-packages/bs4/builder/_html5lib.py", line 70, in <module>
    class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: 'module' object has no attribute '_base'

after many pip installation, html5lib downgrade, i have find this https://patchwork.openembedded.org/patch/134417/

and i have removed underscore from _base in
/home/frappe/frappe-bench/env/lib/python2.7/site-packages/bs4/builder/_html5lib.py

bench --site all migrate work

is it correct?

1 Like

I had to do the same. Thank you for sharing the solution. However, I wish to know what that means and if its done correctly.

I dont know, I asked for confirmation too.

This morning, taking advantage of Sunday, I’m updating the instance in production version 10, and I found the same problem. I also see various posts on the community with the same problem.

on version 10 dosent work…many error when try login

i have created an issue on github
https://github.com/frappe/erpnext/issues/15900

Some how i fix this error by replacing _base by base (remove _)
This may fix your issue

In which file, you have changed?

in this file
/home/frappe/frappe-bench/env/lib/python2.7/site-packages/bs4/builder/_html5lib.p