lightweight
lightweight

Reputation: 3327

python can't find google cloud module

I spun up a instance on google compute and google-cloud came install but when I try and run my python code: python3 sensorgen.py, I get this:

root@nomad-clients-rp-4bhr:/usr/local/lib/python3.5/dist-packages# python3 ~/sensorgen.py 
Traceback (most recent call last):
  File "/root/sensorgen.py", line 6, in <module>
    from google.cloud import pubsub_v1
ImportError: No module named 'google'

but it is installed....

root@nomad-clients-rp-4bhr:/usr/local/lib/python3.5/dist-packages# pip3 show google-cloud
---
Metadata-Version: 2.1
Name: google-cloud
Version: 0.34.0
Summary: API Client library for Google Cloud
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google Cloud Platform
Author-email: [email protected]
Installer: pip
License: Apache 2.0
Location: /usr/local/lib/python3.5/dist-packages
Requires: 
Classifiers:
  Development Status :: 7 - Inactive
  Intended Audience :: Developers
  License :: OSI Approved :: Apache Software License
  Operating System :: OS Independent
  Programming Language :: Python :: 2
  Programming Language :: Python :: 2.7
  Programming Language :: Python :: 3
  Programming Language :: Python :: 3.4
  Programming Language :: Python :: 3.5
  Programming Language :: Python :: 3.6
  Topic :: Internet
You are using pip version 8.1.1, however version 18.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

I've done pip3 install google-cloud --upgrade...did and uninstall and reinstall, but still no go....

Upvotes: 1

Views: 3718

Answers (2)

Alex
Alex

Reputation: 199

Just try pip install google and re-execute the python script Also do upgrade the pip

Upvotes: 1

miguelfrancisco85
miguelfrancisco85

Reputation: 542

Looks like you want to use pubsub with python, according the documentation you should install the module with the following command:

pip install --upgrade google-cloud-pubsub

If this doesn't work you can update pip and pip3 with apt:

sudo apt install python3-pip python-pip
pip install --upgrade google-cloud-pubsub

Upvotes: 2

Related Questions