Recently, we were receiving the above error on a GNU/Linux Ubuntu 20.04 LTS.
AttributeError: module 'html5lib.treebuilders' has no attribute '_base'
We had installed beautifulsoup4 and html5lib using pip. To solve the issue, we had to uninstall the html5lib that was installed by pip and install it through apt.
# Remove html5lib if you have installed it with pip3:
pip3 uninstall html5lib;
pip3 install --upgrade beautifulsoup4
sudo apt-get install python3-html5lib
This post is also available in: Αγγλικα