Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 579
Jacob Avatar asked Aug 24 '26 16:08

Jacob


2 Answers

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

like image 183
Shubham Chaudhari Avatar answered Aug 26 '26 04:08

Shubham Chaudhari


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

like image 33
Fred Avatar answered Aug 26 '26 06:08

Fred