1

I'm trying to run the following command in cloud sdk to send a command to cloud IOT

python3 main.py --send_command="$RESPONSE" --registry=REGISTRY NAME --device=DEVICE NAME --cloud_region=europe-west1 --project_id=PROJECT ID send-command

I am getting the following error message.

Traceback (most recent call last):
  File "main.py", line 37, in <module>
    from google.api_core.exceptions import AlreadyExists
ModuleNotFoundError: No module named 'google

I tried the following workarounds but had no luck.

pip install --upgrade google-api-core
pip install google-cloud
pip install google-cloud-vision

Have I missed any libraries?

Python version - Python 3.8.3

a_jelly_fish
  • 478
  • 6
  • 21
achala wb
  • 5
  • 1

1 Answers1

0

If you're not already and willing to consider using virtualenv, it may help (!) resolve the issue because it provides a 'clean room':

python3 -m venv venv
source venv/bin/activate

Then check the current modules:

pip3 freeze

Returns no install modules

Then either:

pip3 install google-api-core
pip3 install google-cloud-vision
pip3 freeze

Or, preferably create requirements.txt:

google-api-core==1.21.0
google-cloud-vision==1.0.0

And:

pip3 install --requirement ./requirements.txt
pip3 freeze

Returns:

cachetools==4.1.0
certifi==2020.4.5.2
chardet==3.0.4
google-api-core==1.21.0
google-auth==1.18.0
google-cloud-vision==1.0.0
googleapis-common-protos==1.52.0
idna==2.9
protobuf==3.12.2
pyasn1==0.4.8
pyasn1-modules==0.2.8
pytz==2020.1
requests==2.24.0
rsa==4.6
six==1.15.0
urllib3==1.25.9

NOTE the list and versions will change

Then checking the import will suceed:

python3 -c "from google.api_core.exceptions import AlreadyExists"
DazWilkin
  • 32,823
  • 5
  • 47
  • 88