7

I try to use soup4 with my python3.5 ,but evrey time i rule a code to extrac something from internet i get this error :

 - s4\__init__.py", line 198, in __init__
       % ",".join(features)) bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to    install a parser library?

There was a link with the same error in this site bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library? I tried all , still get the error

All the pip install requests pip install lxml pip install beautifull soup4

I download soup4 https://www.crummy.com/software/BeautifulSoup/bs4/download/4.6/ manual an install it setup.py install

I have all updated and working , but still i get the error plz help me

user10451243
  • 101
  • 1
  • 1
  • 5

4 Answers4

17

If you are using html5lib as an underlying parser:

soup = BeautifulSoup(html, "html5lib")
#                            ^HERE^

Then, you need to have html5lib module installed in your python environment:

pip install html5lib

Documentation reference: Installing a parser.

alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
3

For those that get the same error even with html5lib installed, replace "html5lib" for "html.parser" as suggested in https://github.com/coursera-dl/edx-dl/issues/434

Worked for me :)

dduque
  • 338
  • 4
  • 16
1

Use 'html.parser' instead of 'html5lib'. This will work.

Mike Brian Olivera
  • 1,414
  • 1
  • 16
  • 21
0

For me html.parser work

from bs4 import BeautifulSoup
import urllib.request 
response = urllib.request.urlopen('http://php.net/') 
html = response.read()
soup = BeautifulSoup(html,"html.parser")
text = soup.get_text(strip=True)
print (text)
Vijay
  • 141
  • 7