How Do You Troubleshoot This Message “ImportError: No module named ‘google.cloud’?

Problem scenario
You run a Python program or from the Python command prompt you receive this message:
"Traceback (most recent call last):
  File "main.py", line 21, in <module>
    from google.cloud import pubsub_v1
 ImportError: No module named 'google.cloud'"

What should you do to eliminate this problem?

Possible Solution #1
Try to run the program as sudo:
sudo python nameOfProg.py

Possible Solution #2
Try this with or without sudo (depending on whether or not you are using "sudo" to run the Python program):
sudo pip install google-cloud-bigquery
# You may want to omit the "sudo" in the above command.

Possible Solution #3
Prerequisite

This assumes that pip has been installed.  If you need assistance see this posting.

sudo pip uninstall google-cloud-bigquery
sudo pip install google-cloud-bigquery

Leave a comment

Your email address will not be published. Required fields are marked *