The Python Oracle

ImportError: No Module Named bs4 (BeautifulSoup)

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: RPG Blues Looping

--

Chapters
00:00 Importerror: No Module Named Bs4 (Beautifulsoup)
00:24 Accepted Answer Score 301
00:53 Answer 2 Score 19
01:08 Answer 3 Score 66
01:20 Answer 4 Score 18
01:26 Thank you

--

Full question
https://stackoverflow.com/questions/1178...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #beautifulsoup #flask #importerror

#avk47



ACCEPTED ANSWER

Score 301


Activate the virtualenv, and then install BeautifulSoup4:

$ pip install BeautifulSoup4

When you installed bs4 with easy_install, you installed it system-wide. So your system python can import it, but not your virtualenv python. If you do not need bs4 to be installed in your system python path, uninstall it and keep it in your virtualenv.

For more information about virtualenvs, read this




ANSWER 2

Score 66


For python2.x:

sudo pip install BeautifulSoup4

For python3:

sudo apt-get install python3-bs4



ANSWER 3

Score 19


Just tagging onto Balthazar's answer. Running

pip install BeautifulSoup4

did not work for me. Instead use

pip install beautifulsoup4



ANSWER 4

Score 18


Try this:

sudo python3 -m pip install bs4