How to install google.cloud with Python pip?

Bob van Luijt picture Bob van Luijt · Jan 24, 2017 · Viewed 19.6k times · Source

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...

Answer

John picture John · Jan 29, 2017

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