Process to install Python 3.4 and BeautifulSoup4 on Windows 7

10,167 views
Skip to first unread message

Sam Wainford

unread,
Apr 10, 2015, 9:29:04 PM4/10/15
to beauti...@googlegroups.com
There are many ways to install BeautifulSoup for Python documented on the web, but there are also lots of people getting errors. I could not find a single tutorial, video or forum that actually stepped through the entire process for Python 3x and BeautifulSoup4 on Windows 7. This is what worked for me by piecing together information from various sources.

Install Python 3x: 

Go to https://www.python.org/downloads/ and download Python 3.4.3 for Windows. The default is the 32 bit version, which works fine on either 32 or 64 bit OS. 

Double click the .msi file to run the intaller. Python will install to C:\Python34.

Go to Start > All Programs > Python 3.4 > IDLE (Python 3.4 GUI 32 bit) and the basic IDE will launch.

Test the installation by using simple math. After the prompt >>>, type:
>>>3 + 4

Hit enter. If you get the number 7 as the result with no errors, Python is working. 

Install BeautifulSoup 4:

BeautifulSoup4 is compatible with Python 3x and 2x, but the installation process is a bit different. The following is how I installed it for Python 3x. 


Navigate to the folder where you downloaded the file. Use 7zip to extract the beautifulsoup4-4.3.2.tar.gz  file. 

Double click the beautifulsoup4-4.3.2.tar.gz folder to drill down though the dist folder and then extract the beautifulsoup4-4.3.2.tar file.

Double click the beautifulsoup4-4.3.2.tar folder to drill down through yet another beautifulsoup4-4.3.2 folder. Inside the beautifulsoup4-4.3.2 folder you will see the setup.py file.

Hold down the Shift key while right clicking anywhere inside the folder and select Open command window here.

At the command prompt type: setup.py install and press Enter. 

When then installation stops running, verify that the package was installed by navigating to the C:\Python34\Lib\site-packages directory. If installed you will see the bs4 directory.

Verify that the installation is working by going to Go to Start > All Programs > Python 3.4 > IDLE (Python 3.4 GUI 32 bit) to launch the basic IDE.

After the prompt type: >>>from bs4 import BeautifulSoup

If you receive no errors it is working. 

david cousquer

unread,
Jul 3, 2016, 10:44:39 AM7/3/16
to beautifulsoup
Thanks. Saved me from a long period of unsuccessful attempts!

Rahul Khandalkar

unread,
Jul 5, 2016, 1:18:01 PM7/5/16
to beautifulsoup
Thank you, It was very helpful

Liuxun Zhu

unread,
Jul 22, 2016, 6:34:51 PM7/22/16
to beautifulsoup
Thank you, it works!

samo...@gmail.com

unread,
Oct 10, 2016, 10:45:13 AM10/10/16
to beautifulsoup
thanks alot

Michael Odal

unread,
Nov 12, 2016, 6:59:55 AM11/12/16
to beautifulsoup
Thanks man. Worked like a charm!

Bhaskar Dev

unread,
Feb 7, 2017, 8:11:06 AM2/7/17
to beautifulsoup


On Friday, April 10, 2015 at 8:29:04 PM UTC-5, Sam Wainford wrote:
Here is my result
===========================

E:\beautifulsoup4-4.5.3>setup.py install
running install
running bdist_egg
running egg_info
writing dependency_links to beautifulsoup4.egg-info\dependency_links.txt
writing requirements to beautifulsoup4.egg-info\requires.txt
writing beautifulsoup4.egg-info\PKG-INFO
writing top-level names to beautifulsoup4.egg-info\top_level.txt
reading manifest file 'beautifulsoup4.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'beautifulsoup4.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
creating build
creating build\lib
creating build\lib\bs4
copying bs4\1631353.py -> build\lib\bs4
copying bs4\dammit.py -> build\lib\bs4
copying bs4\diagnose.py -> build\lib\bs4
copying bs4\element.py -> build\lib\bs4
copying bs4\testing.py -> build\lib\bs4
copying bs4\__init__.py -> build\lib\bs4
creating build\lib\bs4\builder
copying bs4\builder\_html5lib.py -> build\lib\bs4\builder
copying bs4\builder\_htmlparser.py -> build\lib\bs4\builder
copying bs4\builder\_lxml.py -> build\lib\bs4\builder
copying bs4\builder\__init__.py -> build\lib\bs4\builder
creating build\lib\bs4\tests
copying bs4\tests\test_builder_registry.py -> build\lib\bs4\tests
copying bs4\tests\test_docs.py -> build\lib\bs4\tests
copying bs4\tests\test_html5lib.py -> build\lib\bs4\tests
copying bs4\tests\test_htmlparser.py -> build\lib\bs4\tests
copying bs4\tests\test_lxml.py -> build\lib\bs4\tests
copying bs4\tests\test_soup.py -> build\lib\bs4\tests
copying bs4\tests\test_tree.py -> build\lib\bs4\tests
copying bs4\tests\__init__.py -> build\lib\bs4\tests
Fixing build\lib\bs4\1631353.py build\lib\bs4\dammit.py build\lib\bs4\diagnose.p
y build\lib\bs4\element.py build\lib\bs4\testing.py build\lib\bs4\__init__.py bu
ild\lib\bs4\builder\_html5lib.py build\lib\bs4\builder\_htmlparser.py build\lib\
bs4\builder\_lxml.py build\lib\bs4\builder\__init__.py build\lib\bs4\tests\test_
builder_registry.py build\lib\bs4\tests\test_docs.py build\lib\bs4\tests\test_ht
ml5lib.py build\lib\bs4\tests\test_htmlparser.py build\lib\bs4\tests\test_lxml.p
y build\lib\bs4\tests\test_soup.py build\lib\bs4\tests\test_tree.py build\lib\bs
4\tests\__init__.py
Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
Fixing build\lib\bs4\1631353.py build\lib\bs4\dammit.py build\lib\bs4\diagnose.p
y build\lib\bs4\element.py build\lib\bs4\testing.py build\lib\bs4\__init__.py bu
ild\lib\bs4\builder\_html5lib.py build\lib\bs4\builder\_htmlparser.py build\lib\
bs4\builder\_lxml.py build\lib\bs4\builder\__init__.py build\lib\bs4\tests\test_
builder_registry.py build\lib\bs4\tests\test_docs.py build\lib\bs4\tests\test_ht
ml5lib.py build\lib\bs4\tests\test_htmlparser.py build\lib\bs4\tests\test_lxml.p
y build\lib\bs4\tests\test_soup.py build\lib\bs4\tests\test_tree.py build\lib\bs
4\tests\__init__.py
Skipping implicit fixer: buffer
Skipping implicit fixer: idioms
Skipping implicit fixer: set_literal
Skipping implicit fixer: ws_comma
creating build\bdist.win32
creating build\bdist.win32\egg
creating build\bdist.win32\egg\bs4
copying build\lib\bs4\1631353.py -> build\bdist.win32\egg\bs4
creating build\bdist.win32\egg\bs4\builder
copying build\lib\bs4\builder\_html5lib.py -> build\bdist.win32\egg\bs4\builder
copying build\lib\bs4\builder\_htmlparser.py -> build\bdist.win32\egg\bs4\builde
r
copying build\lib\bs4\builder\_lxml.py -> build\bdist.win32\egg\bs4\builder
copying build\lib\bs4\builder\__init__.py -> build\bdist.win32\egg\bs4\builder
copying build\lib\bs4\dammit.py -> build\bdist.win32\egg\bs4
copying build\lib\bs4\diagnose.py -> build\bdist.win32\egg\bs4
copying build\lib\bs4\element.py -> build\bdist.win32\egg\bs4
copying build\lib\bs4\testing.py -> build\bdist.win32\egg\bs4
creating build\bdist.win32\egg\bs4\tests
copying build\lib\bs4\tests\test_builder_registry.py -> build\bdist.win32\egg\bs
4\tests
copying build\lib\bs4\tests\test_docs.py -> build\bdist.win32\egg\bs4\tests
copying build\lib\bs4\tests\test_html5lib.py -> build\bdist.win32\egg\bs4\tests
copying build\lib\bs4\tests\test_htmlparser.py -> build\bdist.win32\egg\bs4\test
s
copying build\lib\bs4\tests\test_lxml.py -> build\bdist.win32\egg\bs4\tests
copying build\lib\bs4\tests\test_soup.py -> build\bdist.win32\egg\bs4\tests
copying build\lib\bs4\tests\test_tree.py -> build\bdist.win32\egg\bs4\tests
copying build\lib\bs4\tests\__init__.py -> build\bdist.win32\egg\bs4\tests
copying build\lib\bs4\__init__.py -> build\bdist.win32\egg\bs4
byte-compiling build\bdist.win32\egg\bs4\1631353.py to 1631353.cpython-34.pyc
byte-compiling build\bdist.win32\egg\bs4\builder\_html5lib.py to _html5lib.cpyth
on-34.pyc
byte-compiling build\bdist.win32\egg\bs4\builder\_htmlparser.py to _htmlparser.c
python-34.pyc
byte-compiling build\bdist.win32\egg\bs4\builder\_lxml.py to _lxml.cpython-34.py
c
byte-compiling build\bdist.win32\egg\bs4\builder\__init__.py to __init__.cpython
-34.pyc
byte-compiling build\bdist.win32\egg\bs4\dammit.py to dammit.cpython-34.pyc
byte-compiling build\bdist.win32\egg\bs4\diagnose.py to diagnose.cpython-34.pyc
byte-compiling build\bdist.win32\egg\bs4\element.py to element.cpython-34.pyc
byte-compiling build\bdist.win32\egg\bs4\testing.py to testing.cpython-34.pyc
byte-compiling build\bdist.win32\egg\bs4\tests\test_builder_registry.py to test_
builder_registry.cpython-34.pyc
byte-compiling build\bdist.win32\egg\bs4\tests\test_docs.py to test_docs.cpython
-34.pyc
byte-compiling build\bdist.win32\egg\bs4\tests\test_html5lib.py to test_html5lib
.cpython-34.pyc
byte-compiling build\bdist.win32\egg\bs4\tests\test_htmlparser.py to test_htmlpa
rser.cpython-34.pyc
byte-compiling build\bdist.win32\egg\bs4\tests\test_lxml.py to test_lxml.cpython
-34.pyc
byte-compiling build\bdist.win32\egg\bs4\tests\test_soup.py to test_soup.cpython
-34.pyc
byte-compiling build\bdist.win32\egg\bs4\tests\test_tree.py to test_tree.cpython
-34.pyc
byte-compiling build\bdist.win32\egg\bs4\tests\__init__.py to __init__.cpython-3
4.pyc
byte-compiling build\bdist.win32\egg\bs4\__init__.py to __init__.cpython-34.pyc
creating build\bdist.win32\egg\EGG-INFO
copying beautifulsoup4.egg-info\PKG-INFO -> build\bdist.win32\egg\EGG-INFO
copying beautifulsoup4.egg-info\SOURCES.txt -> build\bdist.win32\egg\EGG-INFO
copying beautifulsoup4.egg-info\dependency_links.txt -> build\bdist.win32\egg\EG
G-INFO
copying beautifulsoup4.egg-info\requires.txt -> build\bdist.win32\egg\EGG-INFO
copying beautifulsoup4.egg-info\top_level.txt -> build\bdist.win32\egg\EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist\beautifulsoup4-4.5.3-py3.4.egg' and adding 'build\bdist.win32\egg
' to it
removing 'build\bdist.win32\egg' (and everything under it)
Processing beautifulsoup4-4.5.3-py3.4.egg
Copying beautifulsoup4-4.5.3-py3.4.egg to c:\python34\lib\site-packages
Adding beautifulsoup4 4.5.3 to easy-install.pth file

Installed c:\python34\lib\site-packages\beautifulsoup4-4.5.3-py3.4.egg
Processing dependencies for beautifulsoup4==4.5.3
Finished processing dependencies for beautifulsoup4==4.5.3



========================================================

But I cant find the bs4 file under Python directory. What can I do now? Please help me.








 

Michael#

unread,
Feb 20, 2017, 2:29:07 PM2/20/17
to beautifulsoup
Bhaskar Dev

I was also unable to identify the bs4 folder under the Python directory.
I guess it's a strict requirement. Proceed with the last instructions on the post (pasted again below), and if you receive no errors as indicated, you good to go.
 

Verify that the installation is working by going to Go to Start > All Programs > Python 3.4 > IDLE (Python 3.4 GUI 32 bit) to launch the basic IDE.

After the prompt type: >>>from bs4 import BeautifulSoup

If you receive no errors it is working. 
 

Hope this helps? 

Saiyan Pride

unread,
Sep 14, 2017, 1:47:17 PM9/14/17
to beautifulsoup
not working !when i type from bs4 import beautifulsoup4 it shows error?



>>>from bs4 import beautifulSoup4
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    from bs4 import beautifulSoup4
  File "C:\Users\Rage Destroyer\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bs4\__init__.py", line 30, in <module>
    from .builder import builder_registry, ParserRejectedMarkup
  File "C:\Users\Rage Destroyer\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bs4\builder\__init__.py", line 308, in <module>
    from . import _htmlparser
  File "C:\Users\Rage Destroyer\AppData\Local\Programs\Python\Python36-32\lib\site-packages\bs4\builder\_htmlparser.py", line 7, in <module>
    from html.parser import (
ImportError: cannot import name 'HTMLParseError'
>>> 

prasann sethi

unread,
Oct 16, 2017, 8:18:48 PM10/16/17
to beautifulsoup
i am getting the same error

Marx babu

unread,
Nov 24, 2017, 7:19:49 AM11/24/17
to beautifulsoup
Exactly same error ,I am using python3.6 with windows ,what else is missing here..
Any solution for this 

Pooja Steven

unread,
Mar 26, 2018, 7:41:11 AM3/26/18
to beautifulsoup
I am receiving  same error... Any resolution?
Reply all
Reply to author
Forward
0 new messages