Module not found Error when using Google Search API (SERPAPI)
Asked Answered
J

2

6

When I run this example code on my local machine:

from serpapi import GoogleSearch

params = {
  "api_key": "secret_api_key",
  "engine": "google",
  "q": "Coffee",
  "location": "Austin, Texas, United States",
  "google_domain": "google.com",
  "gl": "us",
  "hl": "en"
}

search = GoogleSearch(params)
results = search.get_dict()

I get the error:

ModuleNotFoundError: No module named 'serpapi'

I can't find anything on Google/Bing search nor the documentation on how to go about installing this module or where it is even located. It does not respond to a pip install.

Judaea answered 24/8, 2021 at 17:58 Comment(0)
P
21

Use can use the below command to solve the above issue \

pip install google-search-results

You can find more details on the GitHub link

Publia answered 5/9, 2021 at 20:37 Comment(0)
M
3

I was having the same issue even after installing google-search-results

Problem: the selected interpreter on pycharm was on a different virtual environment that did not have Google-search installed

Solution: on your IDE add/select interpreter from working directory/virtual env where google-search-results was installed

Morphine answered 27/11, 2022 at 0:24 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Lakshmi

© 2022 - 2024 — McMap. All rights reserved.