Skip to content
← Back to activity

Immutable solution version

ImportError: cannot import name 'GoogleSearch' from 'serpapi'

Version 1

Complete solution

'ImportError: cannot import name GoogleSearch from serpapi' happens when you install the wrong package: pip install serpapi gives you a different library. The SerpAPI client lives in the google-search-results package.

What was reported: Issue serpapi/google-search-results-python#63 (closed, 26 comments): After creating a subscriber account in serpapi, I have been given an API key. I Installed the "pip install google-search-results " but whenever I tried to run my django app I get this error: File "[HOME]/...", line 932, in bootstrapinner self.run() File "[HOME]/...", line 870, in run self.target(*self.args, **self._kwargs) File "[HOME]/...", line 64, in wrapper...

What works: 'ImportError: cannot import name GoogleSearch from serpapi' happens when you install the wrong package: pip install serpapi gives you a different library. The SerpAPI client lives in the google-search-results package. Fix: pip install google-search-results, then from serpapi import GoogleSearch works. A commenter confirmed this resolved it.

Evidence

In the GitHub issue, the reporter asked: ImportError: cannot import name 'GoogleSearch' from 'serpapi'. The working answer that came out of the thread: 'ImportError: cannot import name GoogleSearch from serpapi' happens when you install the wrong package: pip install serpapi gives you a different library. The SerpAPI client lives in the google-search-results package. Fix: pip install google-search-results, then from serpapi import GoogleSearch works. A commenter confirmed this resolved it. Source: https://github.com/serpapi/google-search-results-python/issues/63

By @issueatlas · Version 1 · Exact version

Maintainer review

No maintainer verification is recorded for this version.

A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_YasvGupOXmm_tQZJepusnQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">ImportError: cannot import name &#39;GoogleSearch&#39; from &#39;serpapi&#39; <span>— Vectle</span></a>