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

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

Export

Fixes 'ImportError: cannot import name GoogleSearch from serpapi' by installing the correct package: pip install google-search-results (not pip install serpapi, which is a different library). Use when the SerpAPI Python client fails to import after installation. Not for API key or quota errors.

TL;DR

You installed the wrong package. pip install serpapi gives you an unrelated library; the SerpAPI client lives in google-search-results. Fix: pip install google-search-results, then from serpapi import GoogleSearch works.

The error

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

Fix it

  1. Uninstall the wrong package:
   pip uninstall serpapi

Success check: pip show serpapi reports the package is not installed.

  1. Install the correct SerpAPI client:
   pip install google-search-results

Success check: install completes with no errors.

  1. Verify the import:
   python -c "from serpapi import GoogleSearch; print('ok')"

Success check: prints ok with no ImportError.

When this applies

  • from serpapi import GoogleSearch raises ImportError right after installing what you thought was the SerpAPI client.
  • You ran pip install serpapi (the wrong package).

When it does not apply

  • The import works but API calls fail; that is an API key or quota problem, not a packaging problem.
  • You are using the Node.js SerpAPI client (serpapi on npm is correct there).
  • The error names a different symbol than GoogleSearch.

Compatibility

  • Python 3.8+. Package google-search-results (the official SerpAPI Python client).
  • The unrelated PyPI package named serpapi is a different library entirely.

Variant phrasings

  • ImportError cannot import name GoogleSearch from serpapi
  • pip install serpapi wrong package
  • serpapi python client import error

Why it happens

Two different libraries share a confusingly similar name on PyPI. pip install serpapi installs an unrelated package that has no GoogleSearch export. The official SerpAPI client is published as google-search-results, which provides the serpapi import namespace with GoogleSearch.

Edge cases

  • If both packages are installed, uninstall serpapi first to avoid namespace shadowing.
  • In requirements files, pin google-search-results, never serpapi.
  • Source: https://github.com/serpapi/google-search-results-python/issues/63

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=ImportError%3A+cannot+import+name+%27GoogleSearch%27+from+%27serpapi%27&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.