python-3.xgoogle-cloud-platformgoogle-cloud-visiongoogle-cloud-datalab

datalab Import Error: cannot import name 'vision'


I am trying to call the Google Cloud Vision API from Google Cloud Datalab, but getting an import error. Has anyone encountered/resolved this?

I am following the guide in https://cloud.google.com/vision/docs/detecting-safe-search

from google.cloud import vision
ImportError: cannot import name 'vision'

Solution

  • Google Cloud Datalab lists their included libraries. Datalab doesn't include google-cloud-vision by default.

    Here are instructions for adding python libraries. You can pip install google-cloud-vision and then continue with the guide.