BS4 html.parser import error on Windows

714 views
Skip to first unread message

dbv

unread,
Feb 28, 2012, 11:07:51 AM2/28/12
to beautifulsoup
Under Python 2.7.2, I've installed BS4 (beta 9), lxml and html5lib but
get this error

Traceback (most recent call last):
File "C:\....py", line 22, in <module>
from bs4 import BeautifulSoup
File "C:\Python27\lib\site-packages\bs4\__init__.py", line 29, in
<module>
from .builder import builder_registry
File "C:\Python27\lib\site-packages\bs4\builder\__init__.py", line
278, in <module>
from .import _htmlparser
File "C:\Python27\lib\site-packages\bs4\builder\_htmlparser.py",
line 7, in <module>
from html.parser import HTMLParser
ImportError: No module named html.parser

Any thoughts?

Leonard Richardson

unread,
Feb 28, 2012, 11:10:01 AM2/28/12
to beauti...@googlegroups.com
You've got the Python 3 version of the code. How did you install BS4?

Leonard

> --
> You received this message because you are subscribed to the Google Groups "beautifulsoup" group.
> To post to this group, send email to beauti...@googlegroups.com.
> To unsubscribe from this group, send email to beautifulsou...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/beautifulsoup?hl=en.
>

dbv

unread,
Feb 28, 2012, 11:14:38 AM2/28/12
to beautifulsoup
pip install beautifulsoup4

Leonard Richardson

unread,
Feb 28, 2012, 11:19:18 AM2/28/12
to beauti...@googlegroups.com
> pip install beautifulsoup4

This works for me. Can you uninstall beautifulsoup4, then install it
again with the --log option, and send me the log?

Do you have Python 3 installed at all?

Leonard

dbv

unread,
Feb 28, 2012, 11:41:10 AM2/28/12
to beautifulsoup
I have both Python 3.2.2 and Python 2.7.2 installed. Originally, BS4
(beta4 to beta8) was installed for use under Python3 and it worked
without any problems. I also need BS4 (preferably) to work under
Python 2.7.2.

Used pip install beautifulsoup4 from the beautifulsoup4-4.0.0b9
folder. Here is the pip.log file

Downloading/unpacking beautifulsoup8

Getting page http://pypi.python.org/simple/beautifulsoup8
Could not fetch URL http://pypi.python.org/simple/beautifulsoup8:
HTTP Error 404: Not Found (beautifulsoup8 does not have any releases)
Will skip URL http://pypi.python.org/simple/beautifulsoup8 when
looking for download links for beautifulsoup8
Getting page http://pypi.python.org/simple/
Real name of requirement beautifulsoup8 is beautifulsoup4

URLs to search for versions for beautifulsoup8:
* http://pypi.python.org/simple/beautifulsoup4/
Getting page http://pypi.python.org/simple/beautifulsoup4/
Getting page http://www.crummy.com/software/BeautifulSoup/bs4/
Getting page http://www.crummy.com/software/BeautifulSoup/bs4/download/
Analyzing links from page http://pypi.python.org/simple/beautifulsoup4/
Skipping link
http://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.0.0b3.tar.gz#md5=723556d1c50f038f62f58c0828b22f64
(from http://pypi.python.org/simple/beautifulsoup4/); wrong project
name (not beautifulsoup8)
Skipping link
http://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.0.0b6.tar.gz#md5=e17efa53596ecd56c29589b394c3d8b8
(from http://pypi.python.org/simple/beautifulsoup4/); wrong project
name (not beautifulsoup8)
Skipping link
http://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.0.0b8.tar.gz#md5=80843e51cf2c49d30ec2c5fc0b6d303f
(from http://pypi.python.org/simple/beautifulsoup4/); wrong project
name (not beautifulsoup8)
Skipping link
http://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.0.0b7.tar.gz#md5=efe085c8d639410d1b7d66e4765da64f
(from http://pypi.python.org/simple/beautifulsoup4/); wrong project
name (not beautifulsoup8)
Skipping link http://www.crummy.com/software/BeautifulSoup/bs4/
(from http://pypi.python.org/simple/beautifulsoup4/); not a file
Skipping link http://www.crummy.com/software/BeautifulSoup/bs4/download/
(from http://pypi.python.org/simple/beautifulsoup4/); not a file
Analyzing links from page http://www.crummy.com/software/BeautifulSoup/
Skipping link mailto:leon...@segfault.org (from
http://www.crummy.com/software/BeautifulSoup/); unknown archive
format: .org
Skipping link http://www.crummy.com/software/BeautifulSoup/bs3/download/3.x/BeautifulSoup-3.2.1.tar.gz
(from http://www.crummy.com/software/BeautifulSoup/); wrong project
name (not beautifulsoup8)
Skipping link http://www.awaretek.com/python/index.html (from
http://www.crummy.com/software/BeautifulSoup/); unknown archive
format: .html
Skipping link http://www.crummy.com/software/BeautifulSoup/bs4/doc/
(from http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://www.crummy.com/2012/02/02/0 (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://www.crummy.com/software/BeautifulSoup/#Download
(from http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://www.crummy.com/software/BeautifulSoup/bs3/documentation.html
(from http://www.crummy.com/software/BeautifulSoup/); unknown archive
format: .html
Skipping link https://code.launchpad.net/beautifulsoup (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://groups.google.com/group/beautifulsoup (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://www.candlemarkandgleam.com/store/delivery/constellation-games-serial/
(from http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://constellation.crummy.com/Constellation%20Games%20excerpt.html
(from http://www.crummy.com/software/BeautifulSoup/); unknown archive
format: .html
Skipping link http://lxml.de/ (from http://www.crummy.com/software/BeautifulSoup/);
not a file
Skipping link http://code.google.com/p/html5lib/ (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://www.crummy.com/software/BeautifulSoup/doc/
(from http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://www.crummy.com/software/BeautifulSoup/download/3.x/BeautifulSoup-3.2.1.tar.gz
(from http://www.crummy.com/software/BeautifulSoup/); wrong project
name (not beautifulsoup8)
Skipping link https://launchpad.net/beautifulsoup (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link https://code.launchpad.net/beautifulsoup/ (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link https://bugs.launchpad.net/beautifulsoup/ (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://www.crummy.com/source/software/BeautifulSoup/index.bhtml
(from http://www.crummy.com/software/BeautifulSoup/); unknown archive
format: .bhtml
Skipping link http://www.crummy.com/self/ (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://www.crummy.com/self/contact.html (from
http://www.crummy.com/software/BeautifulSoup/); unknown archive
format: .html
Skipping link http://creativecommons.org/licenses/by-sa/2.0/ (from
http://www.crummy.com/software/BeautifulSoup/); unknown archive
format: .0
Skipping link http://www.crummy.com/ (from http://www.crummy.com/software/BeautifulSoup/);
not a file
Skipping link http://www.crummy.com/software/ (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Skipping link http://www.crummy.com/software/BeautifulSoup/ (from
http://www.crummy.com/software/BeautifulSoup/); not a file
Analyzing links from page http://www.crummy.com/software/BeautifulSoup/bs4/download/
Skipping link http://www.crummy.com/software/BeautifulSoup/bs4/download/?C=N;O=D
(from http://www.crummy.com/software/BeautifulSoup/bs4/download/); not
a file
Skipping link http://www.crummy.com/software/BeautifulSoup/bs4/download/?C=M;O=A
(from http://www.crummy.com/software/BeautifulSoup/bs4/download/); not
a file
Skipping link http://www.crummy.com/software/BeautifulSoup/bs4/download/?C=S;O=A
(from http://www.crummy.com/software/BeautifulSoup/bs4/download/); not
a file
Skipping link http://www.crummy.com/software/BeautifulSoup/bs4/download/?C=D;O=A
(from http://www.crummy.com/software/BeautifulSoup/bs4/download/); not
a file
Skipping link http://www.crummy.com/software/BeautifulSoup/bs4/download/4.0/
(from http://www.crummy.com/software/BeautifulSoup/bs4/download/);
unknown archive format: .0
Could not find any downloads that satisfy the requirement
beautifulsoup8

No distributions at all found for beautifulsoup8

Exception information:
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pip\basecommand.py", line 104,
in main
status = self.run(options, args)
File "C:\Python27\lib\site-packages\pip\commands\install.py", line
245, in run
requirement_set.prepare_files(finder,
force_root_egg_info=self.bundle, bundle=self.bundle)
File "C:\Python27\lib\site-packages\pip\req.py", line 978, in
prepare_files
url = finder.find_requirement(req_to_install,
upgrade=self.upgrade)
File "C:\Python27\lib\site-packages\pip\index.py", line 157, in
find_requirement
raise DistributionNotFound('No distributions at all found for %s'
% req)
DistributionNotFound: No distributions at all found for beautifulsoup8

dbv

unread,
Feb 28, 2012, 4:21:35 PM2/28/12
to beautifulsoup
Uninstalled again and re-installed and its working.



On Feb 28, 8:41 am, dbv <dineshbvad...@gmail.com> wrote:
> I have both Python 3.2.2 and Python 2.7.2 installed.  Originally, BS4
> (beta4 to beta8) was installed for use under Python3 and it worked
> without any problems.  I also need BS4 (preferably) to work under
> Python 2.7.2.
>
> Used pip install beautifulsoup4 from the beautifulsoup4-4.0.0b9
> folder.  Here is the pip.log file
>
> Downloading/unpacking beautifulsoup8
>
>   Getting pagehttp://pypi.python.org/simple/beautifulsoup8
>   Could not fetch URLhttp://pypi.python.org/simple/beautifulsoup8:
> HTTP Error 404: Not Found (beautifulsoup8 does not have any releases)
>   Will skip URLhttp://pypi.python.org/simple/beautifulsoup8when
> looking for download links for beautifulsoup8
>   Getting pagehttp://pypi.python.org/simple/
>   Real name of requirement beautifulsoup8 is beautifulsoup4
>
>   URLs to search for versions for beautifulsoup8:
>   *http://pypi.python.org/simple/beautifulsoup4/
>   Getting pagehttp://pypi.python.org/simple/beautifulsoup4/
>   Getting pagehttp://www.crummy.com/software/BeautifulSoup/bs4/
>   Getting pagehttp://www.crummy.com/software/BeautifulSoup/bs4/download/
>   Analyzing links from pagehttp://pypi.python.org/simple/beautifulsoup4/
>     Skipping linkhttp://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup...
> (fromhttp://pypi.python.org/simple/beautifulsoup4/);wrong project
> name (not beautifulsoup8)
>     Skipping linkhttp://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup...
> (fromhttp://pypi.python.org/simple/beautifulsoup4/);wrong project
> name (not beautifulsoup8)
>     Skipping linkhttp://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup...
> (fromhttp://pypi.python.org/simple/beautifulsoup4/);wrong project
> name (not beautifulsoup8)
>     Skipping linkhttp://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup...
> (fromhttp://pypi.python.org/simple/beautifulsoup4/);wrong project
> name (not beautifulsoup8)
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/bs4/
> (fromhttp://pypi.python.org/simple/beautifulsoup4/);not a file
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/bs4/download/
> (fromhttp://pypi.python.org/simple/beautifulsoup4/);not a file
>   Analyzing links from pagehttp://www.crummy.com/software/BeautifulSoup/
>     Skipping link mailto:leona...@segfault.org (fromhttp://www.crummy.com/software/BeautifulSoup/);unknown archive
> format: .org
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/bs3/download/3.x/Beautif...
> (fromhttp://www.crummy.com/software/BeautifulSoup/);wrong project
> name (not beautifulsoup8)
>     Skipping linkhttp://www.awaretek.com/python/index.html(fromhttp://www.crummy.com/software/BeautifulSoup/);unknown archive
> format: .html
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/bs4/doc/
> (fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://www.crummy.com/2012/02/02/0(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/#Download
> (fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/bs3/documentation.html
> (fromhttp://www.crummy.com/software/BeautifulSoup/);unknown archive
> format: .html
>     Skipping linkhttps://code.launchpad.net/beautifulsoup(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://groups.google.com/group/beautifulsoup(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://www.candlemarkandgleam.com/store/delivery/constellation-games-...
> (fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://constellation.crummy.com/Constellation%20Games%20excerpt.html
> (fromhttp://www.crummy.com/software/BeautifulSoup/);unknown archive
> format: .html
>     Skipping linkhttp://lxml.de/(fromhttp://www.crummy.com/software/BeautifulSoup/);
> not a file
>     Skipping linkhttp://code.google.com/p/html5lib/(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/doc/
> (fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/download/3.x/BeautifulSo...
> (fromhttp://www.crummy.com/software/BeautifulSoup/);wrong project
> name (not beautifulsoup8)
>     Skipping linkhttps://launchpad.net/beautifulsoup(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttps://code.launchpad.net/beautifulsoup/(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttps://bugs.launchpad.net/beautifulsoup/(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://www.crummy.com/source/software/BeautifulSoup/index.bhtml
> (fromhttp://www.crummy.com/software/BeautifulSoup/);unknown archive
> format: .bhtml
>     Skipping linkhttp://www.crummy.com/self/(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://www.crummy.com/self/contact.html(fromhttp://www.crummy.com/software/BeautifulSoup/);unknown archive
> format: .html
>     Skipping linkhttp://creativecommons.org/licenses/by-sa/2.0/(fromhttp://www.crummy.com/software/BeautifulSoup/);unknown archive
> format: .0
>     Skipping linkhttp://www.crummy.com/(fromhttp://www.crummy.com/software/BeautifulSoup/);
> not a file
>     Skipping linkhttp://www.crummy.com/software/(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/(fromhttp://www.crummy.com/software/BeautifulSoup/);not a file
> (fromhttp://www.crummy.com/software/BeautifulSoup/bs4/download/);not
> (fromhttp://www.crummy.com/software/BeautifulSoup/bs4/download/);not
> a file
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/bs4/download/?C=S;O=A
> (fromhttp://www.crummy.com/software/BeautifulSoup/bs4/download/);not
> a file
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/bs4/download/?C=D;O=A
> (fromhttp://www.crummy.com/software/BeautifulSoup/bs4/download/);not
> a file
>     Skipping linkhttp://www.crummy.com/software/BeautifulSoup/bs4/download/4.0/
> (fromhttp://www.crummy.com/software/BeautifulSoup/bs4/download/);
Reply all
Reply to author
Forward
0 new messages