How to install google.cloud with Python pip?
Asked Answered
Q

4

19

I am relatively new to Python and I am stuck on something which is probably relatively easy to resolve.

I have installed the following packages:

pip install --upgrade google-api-python-client
pip install --upgrade google-cloud
pip install --upgrade google-cloud-vision

In my Python file I have:

import cv2
import io
import os

# Imports the Google Cloud client library
from google.cloud import vision

...etc...

And this gives me the error:

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    from google.cloud import vision
ImportError: No module named 'google.cloud'

What am I missing and where should I look (logs?) to find the answer in the future.

PS:
Pip installs of google-cloud and google-cloud-vision have the output:

Cannot remove entries from nonexistent file /Users/foobar/anaconda/lib/python3.5/site-packages/easy-install.pth

UPDATE:
Running pip freeze doesn't show the packages to be installed...

Quarter answered 24/1, 2017 at 18:38 Comment(3)
The above worked for me on both Windows and Ubuntu (using Python 3.5). Try again in a fresh conda environment perhaps?Somewise
Hmm, nope, that doesn't do the trick either...Quarter
Also updated the question...Quarter
I
4

I had a similar problem. Adding "--ignore-installed" to my pip command made it work for me.

This might be a bug in pip - see this page for more details: https://github.com/pypa/pip/issues/2751

Infrangible answered 29/1, 2017 at 22:25 Comment(0)
A
1

You need to download and install the google-cloud-sdk. Follow this link https://cloud.google.com/sdk/docs/

Actinic answered 11/3, 2017 at 5:41 Comment(0)
T
0

To install the Google Cloud Vision API library in PyCharm for your project, follow these simple steps:

  • Open PyCharm and navigate to your project folder.

  • Once inside your project folder, find the option "Open in" and locate the local terminal associated with that folder within PyCharm.

  • In the terminal, type the following command:

pip install google-vision-cloud
  • Press Enter to execute the command.
  • Wait for the installation process to complete. Once the installation is finished, you can start using the Google Cloud Vision API in your Python projects.
Trying answered 11/4 at 21:3 Comment(0)
S
-7

try this :

from google.cloud.vision import *
Sweep answered 30/8, 2018 at 11:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.