FeatureNotFound Error When Running BeautifulSoup
Jul 20
1 min read
When running BeautifulSoup on AWS Lambda with python3.9 as follows
soup = BeautifulSoup(response.text, 'lxml')I'm noting down how I dealt with the following error, for future reference.
[ERROR] FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?Fix 1: Installing lxml
From the error message I thought installing the lxml parser would solve it, so I installed the lxml library
pip install lxml -t .But the behaviour didn't change...
Fix 2: Using html5lib instead of lxml
BeautifulSoup supports html5lib as a parser besides lxml, so let's try using html5lib.
If html5lib isn't installed, install it.
pip install html5lib -t .Modify the BeautifulSoup call as follows.
soup = BeautifulSoup(response.text, 'html5lib')I ran it and it was solved.
I had no particular reason to insist on lxml, so I settled on this.
![[September 2026] AI & IT News Roundup for SMBs|6 Handpicked Stories](https://static.wixstatic.com/media/5b7c68_147333112cfc4639a957819174666aea~mv2.png/v1/fill/w_980,h_515,al_c,q_90,usm_0.66_1.00_0.01,enc_avif,quality_auto/5b7c68_147333112cfc4639a957819174666aea~mv2.png)


Comments