Solving pip install google Error – ImportError: No module named ‘google’

ImportError: No module named ‘google’ is an error which happens when you try installing google in python using pip.

In this article I am going to explain what happens when you get this error and how you can solve it with a main solution, we will also explore other solutions which can possibly solve the issue.

Exploring the ImportError: No module named ‘google’

The error usually happens when developers try to install google in python using pip. For example by using the command bellow.

                                                                       #
pip install google
                                                                       #

The error massage will usually look like this

                                                                       #
Traceback
...
No module named 'google'
                                                                       #

Bellow I will present multiple solutions some have worked for me and others have worked for other developers.

Solution 1 : delete Anaconda & python, Re-install Anaconda. Then install google using pip.

The first solution is to delete Anaconda & python, Re-install Anaconda. Then install google using pip.

First, you should delete Anaconda & python.

Second step is to Re-install Anaconda (But not python)

Third step is to point Anaconda prompt to Anaconda/Scripts

Now, you can install google using pip.

                                                                       #
pip install google
                                                                       #

The solution should have solved the issue and the error should be gone. If that is not the case, please consider trying the solution bellow.

Solution 2 : for people who want to import translate from google.cloud

This solution is only for people who want to  import translate from google.cloud

If you want to import translate from google.cloud, you should first install protobuf using pip

                                                                       #
pip install protobuf
                                                                       #

Then install translate using the command bellow.

                                                                       #
pip install google-cloud-translate
                                                                       #

The solution above is a solution for a small amount of people try the on bellow.

Solution 3 : install the google-api-python-client 

The last solution is to install the google-api-python-client. You can do that by running the command bellow.

                                                                       #
pip install --upgrade google-api-python-client
                                                                       #

Visit https://github.com/googleapis/google-api-python-client#installation

Other options are:

Install google.cloud.bigquery or/and google.cloud.storage like in the two commands bellow.

                                                                       #
pip install google.cloud.storage
                                                                       #
                                                                       #
pip install google.cloud.bigquery
                                                                       #

Or install google-cloud or/and google-cloud-vision like in the two commands bellow.

                                                                       #
pip install google-cloud
                                                                       #
                                                                       #
pip install google-cloud-vision
                                                                       #

I hope the solutions and commands above solved your issue, cheers.

If this article has been useful for your particular case, consider donating to our Kofi account, there is a red button at the top of this page.

Summing-up

This is the end of this article, I hope this helped you solve the error or at least guided you in the right way. You can donate to our Kofi account if you feel generous but you do not Have to. Keep coding and learning, cheers.

If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/