Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to install package Beautiful Soup. Error Message is "SyntaxError: Missing parentheses in call to 'print'"

I have installed Python 3.5 on my Windows 8 Computer. I have also installed Pycharm Community Version 5.0.4. I am not able to install BeautifulSoup Module through Settings Option in Pycharm. I am getting the following error in Pycharm:

Collecting BeautifulSoup   Using cached BeautifulSoup-3.2.1.tar.gz   Complete output from command python setup.py egg_info:   Traceback (most recent call last):     File "<string>", line 1, in <module>     File "C:\Users\Kashyap\AppData\Local\Temp\pycharm-packaging0.tmp\BeautifulSoup\setup.py", line 22       print "Unit tests have failed!"                                     ^   SyntaxError: Missing parentheses in call to 'print'    ----------------------------------------  Command "python setup.py egg_info" failed with error code 1 in C:\Users\Kashyap\AppData\Local\Temp\pycharm-packaging0.tmp\BeautifulSoup 

Path of installed folder of Python is 3.5.1 (C:\Program Files (x86)\Python35-32\python.exe)

like image 621
bharadwaj Avatar asked Mar 02 '16 13:03

bharadwaj


People also ask

How do you put beautiful soup on PIP?

To install Beautifulsoup on Windows, Linux, or any operating system, one would need pip package. To check how to install pip on your operating system, check out – PIP Installation – Windows || Linux. Wait and relax, Beautifulsoup would be installed shortly.

How do I import from beautifulsoup4?

For Windows... Go to start menu type cmd right click on cmd icon click run as administrator then type pip install beautifulsoup4. It likely will fail to install correctly if you fail to do the above step as even though your windows user is an admin account it does not run all apps as administrator.


2 Answers

You are trying to install BeautifulSoup 3, which is not Python 3 compatible. As the Pycharm error window explains:

Make sure you use a version of Python supported by this package. Currently you are using Python 3.5.

However, you want to install BeautifulSoup 4 instead; the project name for that series has changed to beautifulsoup4. BeautifulSoup 4 has been out for a few years now and supports Python 3.

like image 152
Martijn Pieters Avatar answered Sep 23 '22 17:09

Martijn Pieters


Using Anaconda with the more current BeautifulSoup4 is the easiest.

conda install BeautifulSoup4 

or

pip3 install BeautifulSoup4 
like image 36
Edison Avatar answered Sep 21 '22 17:09

Edison