Prog AF
Prog AF

Reputation: 147

ModuleNotFoundError: No module named 'google'

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.

Upvotes: 10

Views: 30928

Answers (4)

Dzmitry Sankouski
Dzmitry Sankouski

Reputation: 177

My problem was a virtual env and shebang: I used absolute path shebang on Debian 12, like #!/usr/bin/python3, and it ignored active virtualenv.
#!/usr/bin/env python worked, because it uses python from virtualenv, not systemwide.

See What shebang to use for Python scripts run under a pyenv virtualenv

Upvotes: 0

Sachin Rajput
Sachin Rajput

Reputation: 248

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

pip install --upgrade google-api-python-client

Upvotes: 9

Iamlearning
Iamlearning

Reputation: 1

pip install google-cloud-bigquery

Upvotes: -1

Darshit Shah
Darshit Shah

Reputation: 669

Install below mentioned package

pip install google-cloud

Upvotes: 2

Related Questions