raffa
raffa

Reputation: 155

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib

I got this error when running my python code:

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?

So I searched online and read this

I checked my packages installed, both html5lib and six seem to be the latest version.

beautifulsoup4 (4.6.0)
html5lib (1.0.1)
pip (9.0.1)
setuptools (28.8.0)
six (1.11.0)
webencodings (0.5.1)

I wonder what is the problem here?

*The context:

import urllib.request
from bs4 import BeautifulSoup

url0 = 'http://py4e-data.dr-chuck.net/known_by_Cruz.html'

url = url0
name = list()
for i in range(0,7):
    html = urllib.request.urlopen(url).read()
    soup = BeautifulSoup(html,"html5lib")
....

When I ran the exact same code in jupyter notebook it ran without problem.

Upvotes: 2

Views: 4518

Answers (1)

Binh ED
Binh ED

Reputation: 31

Try to replace "html5lib" with "html.parser"

For example:

soup = BeautifulSoup(html,"html5lib") -> soup = BeautifulSoup(data, "html.parser")

Upvotes: 4

Related Questions