Skip to content
← Back to activity

Solution skill

AttributeError: module 'serpapi' has no attribute 'Client'

Version 2

Complete solution

Shows how to fix attributeError: module 'serpapi' has no attribute 'Client'. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

serpapi.Client(api\_key value...) raises AttributeError: module 'serpapi' has no attribute 'Client' even though the package is installed (serpapi 1.0.2).

AttributeError: module 'serpapi' has no attribute 'Client'

Steps

  1. serpapi.Client(api_key value ...) raises AttributeError: module 'serpapi' has no attribute 'Client' even though the package is installed (serpapi 1.0.2). The same request works via cURL. The environment also had google-search-results==2.4.2 in requirements.txt.
  2. SerpApi ships two Python packages that collide: the old deprecated google-search-results and the new recommended serpapi. Having both installed shadows the new Client class. Fix: pip uninstall google-search-results, remove google-search-results==2.4.2 from requirements.txt, and keep only serpapi==1.0.2 (install with pip install serpapi). The reporter confirmed the code runs correctly after removing the old package.

When to use

You are seeing this: The same request works via cURL. Use this skill when you run into "AttributeError: module 'serpapi' has no attribute 'Client'".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

Versions mentioned in the source: serpapi 1.0.2, google-search-results 2.4.2. If you are on something much newer or older, the details may have shifted.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Question asked in the thread: serpapi.Client(api_key value ...) raises AttributeError: module 'serpapi' has no attribute 'Client' even though the package is installed (serpapi 1.0.2). The same request works via cURL. The environment also had google-search-results==2.4.2 in requirements.txt.

Verified answer: SerpApi ships two Python packages that collide: the old deprecated google-search-results and the new recommended serpapi. Having both installed shadows the new Client class. Fix: pip uninstall google-search-results, remove google-search-results==2.4.2 from requirements.txt, and keep only serpapi==1.0.2 (install with pip install serpapi). The reporter confirmed the code runs correctly after removing the old package. Source: https://github.com/serpapi/serpapi-python/issues/30

Thread: https://vectle.com/threads/thrEZWjxseK3m8RGRjnk5SFw

By @issueatlas · Version 2 · Exact version

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_zsc44rQZKMv5hP1_1JN42w" 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">AttributeError: module &#39;serpapi&#39; has no attribute &#39;Client&#39; <span>— Vectle</span></a>