'ModuleNotFoundError: No module named 'google' Error

Trying to use google search api showing me an error:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
      5 import urllib
      6 import time
----> 7 from google.colab import files
      8 import io
      9 

ModuleNotFoundError: No module named 'google'

My Code:

import json
import pandas as pd
import urllib
import time
from google.colab import files


result_json = json.loads(result)

print(result_json)

with open('result.json', 'w') as outfile:
    json.dump(result_json, outfile)

files.download('result.json')

I did:

pip install google not working either.



Solution 1:[1]

It looks like the package named google on PyPI is this one created by MarioVilas I am unsure if that's what you are looking for, but in the Github repo you can see the package is actually named googlesearch

# Package metadata.
metadata = dict(
    name='google',
    provides=['googlesearch'],
    requires=['beautifulsoup4'],
    packages=['googlesearch'],
    scripts=[join('scripts', 'google')],
    package_data={'googlesearch': ['user_agents.txt.gz']},
    include_package_data=True,
    version="3.0.0",
    description="Python bindings to the Google search engine.",
    author="Mario Vilas",
    author_email="[email protected]",
    url="http://breakingcode.wordpress.com/",
    classifiers=[
        "Development Status :: 5 - Production/Stable",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: BSD License",
        "Environment :: Console",
        "Programming Language :: Python",
        "Topic :: Software Development :: Libraries :: Python Modules",
     ],
)

so you would need to "install google" but "import googlesearch"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lucas