How to install bs4 in venv?

709 views
Skip to first unread message

Yulia I

unread,
Nov 10, 2019, 3:30:27 PM11/10/19
to beautifulsoup
Could somebody provide step-by-step instruction about how to  get installed  BeatifulSoup4  in venv? 
Python 3.7

I've created a  folder and activated venv. Next I tried with 'pip3 install BeatifulSoup4' and got this error: No matching distr for dound for BeatifulSoup4'
Then I tried to install with this command: sudo apt-get install python3-bs4
It installed. But when I run my script I received this error: Cannot import name BeatifulSoup from bs4

Help, please

facelessuser

unread,
Nov 10, 2019, 3:51:44 PM11/10/19
to beautifulsoup
I believe you misspelled "beautiful"

pip3 install beautifulsoup4

and

from bs4 import BeautifulSoup

Yulia I

unread,
Nov 10, 2019, 3:56:43 PM11/10/19
to beautifulsoup
nope.  BeatifulSoup installed as I checked site-packages folder 

facelessuser

unread,
Nov 10, 2019, 4:06:39 PM11/10/19
to beautifulsoup
If you are importing beautiful as you spelled it (beautiful), that is wrong. If you spelled it the way I did (beautiful), you may have more success when importing.

facelessuser

unread,
Nov 10, 2019, 4:16:58 PM11/10/19
to beautifulsoup
Forgive me, in my last post, my phone keeps auto correcting the wrong spelling, but just double check your spelling.

Yulia I

unread,
Nov 10, 2019, 4:20:19 PM11/10/19
to beautifulsoup
(env) yulia@x250:~/Documents/scraping$ pip list
Package        Version
-------------- -------
beautifulsoup4 4.8.1  
et-xmlfile     1.0.1  
jdcal          1.4.1  
lxml           4.4.1  
numpy          1.17.3 
openpyxl       3.0.0  
pip            19.3.1 
pkg-resources  0.0.0  
setuptools     40.8.0 
soupsieve      1.9.5  

and my example file: 'scrape.py'
from urllib.request import urlopen

from bs4 import BeatifulSoup

soup = BeatifulSoup(html_doc, 'html.parser')
print(soup.prettify())

Cameron Simpson

unread,
Nov 10, 2019, 5:27:43 PM11/10/19
to beauti...@googlegroups.com, ya.iv...@gmail.com
On 10Nov2019 13:20, Yulia I <ya.iv...@gmail.com> wrote:
>and my example file: 'scrape.py'
>from urllib.request import urlopen
>
>from bs4 import BeatifulSoup

Not "BeatifulSoup". "BeautifulSoup". Note the third "u" before the "t".

Cheers,
Cameron Simpson <c...@cskk.id.au>
Reply all
Reply to author
Forward
0 new messages