1

In the notebook machine I was using Spyder3 without any problem until install jupyter-notebook.

When run spyder3 from command line, the next message appear:

File "/usr/lib/python2.7/dist-packages/bs4/builder/_html5lib.py", line 70, in class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):

AttributeError: 'module' object has no attribute '_base'

after some search try the proposed solutions on:

https://github.com/spyder-ide/spyder/issues/4309

https://bugs.launchpad.net/beautifulsoup/+bug/1603299

beautifulsoup, html5lib: module object has no attribute _base

try:

sudo pip install --upgrade beautifulsoup4

sudo pip install --upgrade html5lib

sudo pip install spry

Also reinstall:

sudo pip install --upgrade spyder

One year ago in the desktop machine i had the same problem, i fixed changing some python code but now dont remember how was fixed it.

Also downgrade the html5lib version to the same version of my desktop computer:

sudo -H pip install html5lib==0.9999999

and beautifulsoup4

sudo -H pip install beautifulsoup4==4.4.1


python

import html5lib

html5lib.version

u'0.9999999'

import bs4

bs4.version

'4.4.1'


But nothing happen.

The notebook machine have installed:

Ubuntu 16.04 - 32 bit python 2.7, 3 and 3.5

Any help will be welcome

user2232395
  • 461
  • 5
  • 15
  • (*Spyder maintainer here*) I'm sorry to say it, but due to problems like the one you're describing here is that we recommend using Anaconda instead of pip. Besides, you should really, *really* avoid installing packages with `sudo pip` because you're mixing packages provided by your distribution with the ones installed from PyPI. Instead, you should a virtualenv for this. – Carlos Cordoba Sep 23 '18 at 04:22

2 Answers2

2

I found the solution here: https://github.com/Sigil-Ebook/Sigil/issues/316

open the file: sudo mousepad /usr/lib/python3/dist-packages/bs4/builder/_html5lib.py

and change :

class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):

with

class TreeBuilderForHtml5lib(html5lib.treebuilders.base.TreeBuilder):

and

class Element(html5lib.treebuilders._base.Node):

with

class Element(html5lib.treebuilders.base.Node):

user2232395
  • 461
  • 5
  • 15
0

I had a similar problem after the installation of spyder3 using the ubuntu package manager: spyder was crashing with 'AttributeError: 'module' object has no attribute '_base' Could fix it with: pip install --user --upgrade spyder I guess, the '--user' option is the solution to write the right paths of the modules.

Ma4833
  • 1
  • Thanks, i try but still get the same error: AttributeError: module 'html5lib.treebuilders' has no attribute '_base' – user2232395 Oct 01 '18 at 21:50