{"id":504,"library":"google-cloud-vision","title":"Google Cloud Vision","description":"The `google-cloud-vision` Python client library provides access to the Google Cloud Vision API, a powerful service for image analysis. It enables developers to integrate vision detection features like image labeling, optical character recognition (OCR), face and landmark detection, object localization, and explicit content tagging into their applications. This library is actively maintained by Google, with frequent updates released as part of the broader `google-cloud-python` monorepo.","status":"active","version":"3.13.0","language":"python","source_language":"en","source_url":"https://github.com/googleapis/google-cloud-python/tree/main/packages/google-cloud-vision","tags":["google cloud","vision","ai","image analysis","ocr","machine learning","computer vision"],"install":[{"cmd":"pip install google-cloud-vision","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for the client library.","package":"Python","optional":false}],"imports":[{"wrong":"from google.cloud import vision","symbol":"ImageAnnotatorClient","correct":"from google.cloud.vision import ImageAnnotatorClient"}],"quickstart":{"code":"import os\nfrom google.cloud import vision\n\n# Set up authentication if running locally (e.g., via service account key file)\n# On Google Cloud (e.g., GCE, Cloud Functions), this is often handled automatically.\n# os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = os.environ.get('GOOGLE_APPLICATION_CREDENTIALS', '/path/to/your/keyfile.json')\n\ndef detect_labels_uri(image_uri):\n    \"\"\"Detects labels in the image located in Google Cloud Storage or on the Web.\"\"\"\n    client = vision.ImageAnnotatorClient()\n    image = vision.Image()\n    image.source.image_uri = image_uri\n\n    response = client.label_detection(image=image)\n    labels = response.label_annotations\n    print('Labels:')\n\n    for label in labels:\n        print(f'{label.description}: {label.score:.2f}')\n\n# Example usage with a publicly accessible image URI\n# Make sure the image URI is publicly accessible or your service account has GCS read permissions.\ndetect_labels_uri('gs://cloud-samples-data/vision/label/wakeupcat.jpg')\n","lang":"python","description":"This quickstart demonstrates how to perform label detection on an image from a Google Cloud Storage (GCS) URI. Ensure you have set up Application Default Credentials, typically by setting the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to the path of your service account key file, or by running `gcloud auth application-default login` for local development. For production environments on Google Cloud, authentication is usually handled automatically by the attached service account."},"warnings":[{"fix":"Set `GOOGLE_APPLICATION_CREDENTIALS` environment variable. Grant the 'Cloud Vision API User' IAM role to your service account. For GCS images, ensure the service account also has 'Storage Object Viewer' or similar access.","message":"Authentication is critical and often a source of error. Ensure your environment has valid credentials, typically via the `GOOGLE_APPLICATION_CREDENTIALS` environment variable pointing to a service account key file. On Google Cloud infrastructure (e.g., Compute Engine, Cloud Functions), credentials are often automatically inferred from the service account attached to the resource. Make sure the service account has the 'Cloud Vision API User' role and any necessary GCS permissions if accessing images from buckets.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update your code to use `client = vision.ImageAnnotatorClient()` and refer to types as `vision.Image`, `vision.Feature`, etc. Refer to the migration guide for older versions (though the PyPI version is 3.x, older client libraries could have been 0.x).","message":"Older versions of the client library used `vision.Client()` for instantiation and directly accessed types like `vision.types.Image`. The recommended and current approach uses `vision.ImageAnnotatorClient()` and accesses types directly from the `vision` module (e.g., `vision.Image`, `vision.Feature`).","severity":"breaking","affected_versions":"<= 0.25.0"},{"fix":"Visit the Google Cloud Console, select your project, ensure billing is enabled, and navigate to 'APIs & Services > Library' to enable the 'Cloud Vision API'.","message":"The Google Cloud Vision API requires a Google Cloud project with billing enabled and the Vision API explicitly enabled. Even free tier usage counts against an enabled billing account.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Monitor your API usage in the Google Cloud Console. Validate image inputs (format, size) before sending them. Implement retry logic with exponential backoff for transient errors like `RESOURCE_EXHAUSTED`.","message":"Exceeding API quotas or sending malformed image data are common causes of failures. Errors like `RESOURCE_EXHAUSTED` (429) indicate quota limits, while `INVALID_ARGUMENT` (400) often points to issues with the image format, size, or content.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review the official Vision API deprecations page for details. For OCR On-Prem, migrate to the standard Vision API OCR. Evaluate alternatives or plan for shutdown for other deprecated features.","message":"Specific features within the Vision API have deprecation timelines. 'Vision API Celebrity Recognition' and 'OCR On-Prem' features are deprecated and scheduled for shutdown by September 16, 2025.","severity":"deprecated","affected_versions":"All versions using these specific features"},{"fix":"Understand the distinction between the pre-trained Cloud Vision API and AutoML Vision. If you are using AutoML Vision, migrate to Vertex AI as recommended.","message":"AutoML Vision, a distinct product for custom image models, has had its legacy version deprecated and moved to Vertex AI. This is sometimes confused with the core Cloud Vision API, which remains actively developed and supported.","severity":"gotcha","affected_versions":"Users of AutoML Vision (not the core Vision API)"}],"env_vars":null,"search_vec":"'access':13 'activ':57 'ai':78 'analysi':25,80 'api':19 'applic':53 'broader':69 'charact':38 'client':10 'cloud':2,7,17,72,76 'comput':84 'content':49 'detect':32,44 'develop':28 'enabl':27 'explicit':48 'face':41 'featur':33 'frequent':62 'googl':1,6,16,60,71,75 'google-cloud-python':70 'google-cloud-vis':5 'imag':24,35,79 'integr':30 'label':36 'landmark':43 'learn':83 'librari':11,55 'like':34 'local':46 'machin':82 'maintain':58 'monorepo':74 'object':45 'ocr':40,81 'optic':37 'part':66 'power':21 'provid':12 'python':9,73 'recognit':39 'releas':64 'servic':22 'tag':50 'updat':63 'vision':3,8,18,31,77,85","created_at":"2026-03-28T15:16:27.560774+00:00","updated_at":"2026-04-16T15:24:49.778751+00:00","problems":null,"ecosystem":"pypi","meta_description":null,"install_score":95,"quickstart_score":0,"quickstart_tag":"stale","pypi_latest":"3.15.0","cli_name":"","cli_version":null,"type":"library","homepage":"https://cloud.google.com/vision","github":"https://github.com/googleapis/google-cloud-python","docs":null,"changelog":null,"pypi":"https://pypi.org/project/google-cloud-vision/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["gcp","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-30","last_verified":"2026-08-27","next_check":"2026-07-30","install_tag":"verified"}}