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

serpapi.Client("YOUR API KEY") 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.

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

Source: https://github.com/serpapi/serpapi-python/issues/30