8

Once I am trying to use google search api it's showing me an error:

Traceback (most recent call last):
  File "C:\Users\Maor Ben Lulu\Desktop\Maor\Python\google\google_Bot.py", line 1, in <module>
    from google import google
ModuleNotFoundError: No module named 'google'

My code :

from google import google
import urllib.request
import time
from bs4 import BeautifulSoup

def google_scrape(url):
    thepage = urllib.request.urlopen(url)
    soup = BeautifulSoup(thepage, "html.parser")
#    print(soup.prettify())
    return soup.prettify()
### Rest of the code

I did:

pip install google

But still doesn't work.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Prog AF
  • 127
  • 1
  • 2
  • 8
  • I would like to advice you: if you are going to use google data, you have to use their API .. I tried everything before and nothing works or it works but they block your IP after small time, even if you use these informal packages – Minions Aug 27 '18 at 12:03
  • do you have two python versions installed? and are you sure you did "pip install" using an Administrative CMD window? – Tharaka Devinda Aug 27 '18 at 12:05
  • What do you get when you run `pip list`? – G.Brown Aug 27 '18 at 12:09
  • How many versions of python have you got? Are oyu sure you did pip install on the right version? To check if you have the google module, you can run this command help('modules') To see all availaible modules. – BlueSheepToken Aug 27 '18 at 12:12
  • @G.Brown google 2.0.1 google-api-python-client 1.7.4 google-auth 1.5.1 google-auth-httplib2 0.0.3 google-cloud 0.34.0 google-search 1.0.2 – Prog AF Aug 27 '18 at 12:15
  • Did pip install the libraries for the right interpretor? The best way to know is to run `print(help('modules'))` in your code – BlueSheepToken Aug 27 '18 at 12:45
  • 3
    Possible duplicate of [ImportError after successful pip installation](https://stackoverflow.com/questions/32680081/importerror-after-successful-pip-installation) – ivan_pozdeev Aug 27 '18 at 15:54

3 Answers3

9

This will solve you issue But you have to do import google not from google import google

pip install --upgrade google-api-python-client
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Sachin Rajput
  • 238
  • 7
  • 26
2

Install below mentioned package

pip install google-cloud
Darshit Shah
  • 629
  • 5
  • 5
-1
pip install google-cloud-bigquery
Zoe
  • 27,060
  • 21
  • 118
  • 148