BeautifulSoup breaks after 'pip install jupyter' form Thonny shell

341 views
Skip to first unread message

Michael Borck

unread,
Apr 4, 2017, 9:09:48 AM4/4/17
to thonny
Hi,

Great tool.  I am using Thonny in a classroom environment.

When starting with a fresh installation of Thonny, my simple BeautifulSoup program runs.

After Jupyter notebook server via pip from a Thonny shell,  BeautifulSoup now appears broken.  Fails on the import  I get the following error:

Traceback (most recent call last):
  File "/Users/michael/Desktop/data/simple_bs4.py", line 2, in <module>
    from bs4 import BeautifulSoup
  File "/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bs4/__init__.py", line 30, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bs4/builder/__init__.py", line 314, in <module>
    from . import _html5lib
  File "/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/bs4/builder/_html5lib.py", line 70, in <module>
    class TreeBuilderForHtml5lib(html5lib.treebuilders._base.TreeBuilder):
AttributeError: module 'html5lib.treebuilders' has no attribute '_base'


If I uninstall, jupyter, bs4 is still broken. 

Only solution is start with a fresh Thonny install.

Any ideas how to fix?

Regards,

Michael.
--

Aivar Annamaa

unread,
Apr 4, 2017, 11:31:30 AM4/4/17
to thonny
Hi Michael!

(I first suspected the problem is that Thonny 2.0.7 comes with beautifulsoup4 version which can't handle latest version of html5lib. Installing jupyter you installed latest html5lib and created the conflict.)

Unfortunately I can't reproduce your problem with Thonny 2.0.7 on Windows (I don't have Mac available at the moment).
You could try force-reinstalling newest beautifulsoup4 ("Tools => Open system shell" and pip3 install -U -I beautifulsoup4).

Next Thonny version don't come with beautifulsoup preinstalled (and whole package management should be more robust) therefore version conflicts are less likely there. I'll announce the beta of Thonny 2.1 soon in this list and I hope this will fix your problem.

best regards
Aivar

Michael Borck

unread,
Apr 4, 2017, 9:28:35 PM4/4/17
to thonny
Sorry, I should have mentioned I was on a Mac (little obvious form the paths).  I also wasn't able to duplicate the error on Windows.

The Mac in question has other Python environment installed (OSx and Macports).  Thinking it may be something to do with the environment or my shell, I tried another Mac, without Macports, basic system shell.  Same error.

The force reinstall didn't work, but I will keep trying ideas.  If I find a solution will post here.

It only affecting me, as the majority of the class use Window machines.   I will demo jupter-notebooks from one of my other environments.

Looking forward to 2.1.

Thanks for the quick response (and again for the great tool).

Regards,

Michael.
--
Reply all
Reply to author
Forward
0 new messages