{"id":14455,"library":"azure-cognitiveservices-vision-computervision","title":"Azure Cognitive Services Computer Vision Client Library (Deprecated)","description":"This is a deprecated Python client library for Microsoft Azure Cognitive Services Computer Vision, offering algorithms for image analysis, OCR, and other vision tasks. The current version is 0.9.1. This package is no longer actively maintained and has been superseded by `azure-ai-vision-imageanalysis`. Users are strongly encouraged to migrate to the new library for continued feature updates and non-security bug fixes.","status":"deprecated","version":"0.9.1","language":"en","source_language":"en","source_url":"https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/cognitiveservices/azure-cognitiveservices-vision-computervision","tags":["azure","cognitive services","computer vision","image analysis","OCR","deprecated"],"install":[{"cmd":"pip install azure-cognitiveservices-vision-computervision pillow","lang":"bash","label":"Install library and common dependencies"}],"dependencies":[{"reason":"Required for local image processing, especially for stream-based operations.","package":"pillow","optional":true},{"reason":"Used for authentication credentials (CognitiveServicesCredentials).","package":"msrest","optional":false}],"imports":[{"symbol":"ComputerVisionClient","correct":"from azure.cognitiveservices.vision.computervision import ComputerVisionClient"},{"symbol":"CognitiveServicesCredentials","correct":"from msrest.authentication import CognitiveServicesCredentials"},{"note":"VisualFeatureTypes is part of the 'models' submodule.","wrong":"from azure.cognitiveservices.vision.computervision import VisualFeatureTypes","symbol":"VisualFeatureTypes","correct":"from azure.cognitiveservices.vision.computervision.models import VisualFeatureTypes"}],"quickstart":{"code":"import os\nfrom azure.cognitiveservices.vision.computervision import ComputerVisionClient\nfrom msrest.authentication import CognitiveServicesCredentials\nfrom azure.cognitiveservices.vision.computervision.models import VisualFeatureTypes\n\n# Set up your Computer Vision subscription key and endpoint as environment variables\nVISION_KEY = os.environ.get('VISION_KEY', 'YOUR_VISION_SUBSCRIPTION_KEY')\nVISION_ENDPOINT = os.environ.get('VISION_ENDPOINT', 'YOUR_VISION_ENDPOINT')\n\nif not VISION_KEY or not VISION_ENDPOINT:\n    print(\"Please set the VISION_KEY and VISION_ENDPOINT environment variables.\")\n    exit()\n\n# Authenticate the client\ncredentials = CognitiveServicesCredentials(VISION_KEY)\ncomputervision_client = ComputerVisionClient(VISION_ENDPOINT, credentials)\n\n# Analyze a remote image\nremote_image_url = \"https://learn.microsoft.com/azure/ai-services/computer-vision/media/quickstarts/presentation.png\"\n\nprint(f\"\\nAnalyzing image from URL: {remote_image_url}\")\n\n# Select the visual features to analyze\nimage_features = [VisualFeatureTypes.categories, VisualFeatureTypes.description, VisualFeatureTypes.tags]\n\nanalyzed_results = computervision_client.analyze_image(remote_image_url, image_features)\n\n# Print results\nprint(\"Description:\")\nif analyzed_results.description.captions:\n    for caption in analyzed_results.description.captions:\n        print(f\"  '{caption.text}' with confidence {caption.confidence:.2f}\")\n\nprint(\"Tags:\")\nif analyzed_results.tags:\n    for tag in analyzed_results.tags:\n        print(f\"  '{tag.name}' with confidence {tag.confidence:.2f}\")\n\nprint(\"Categories:\")\nif analyzed_results.categories:\n    for category in analyzed_results.categories:\n        print(f\"  '{category.name}' with confidence {category.score:.2f}\")\n","lang":"python","description":"This quickstart demonstrates how to instantiate the `ComputerVisionClient` and perform a basic image analysis operation on a remote image, extracting its description, tags, and categories. Ensure `VISION_KEY` and `VISION_ENDPOINT` environment variables are set with your Azure Computer Vision resource credentials."},"warnings":[{"fix":"Migrate your code to use `azure-ai-vision-imageanalysis`. Consult the official Azure SDK for Python documentation and migration guides for the new Track 2 SDK patterns.","message":"This library (`azure-cognitiveservices-vision-computervision`) has been deprecated. It stopped receiving new features and non-security bug fixes after November 1, 2024, and will only receive security fixes until that date. All users should migrate to the replacement package, `azure-ai-vision-imageanalysis` (Track 2 SDK).","severity":"breaking","affected_versions":"<=0.9.1"},{"fix":"Migrate your workloads to Computer Vision v3.2 API or newer. The replacement `azure-ai-vision-imageanalysis` package targets newer API versions.","message":"Older Computer Vision API versions (v1.0, v2.0, v2.1, v3.0, and v3.1) will be retired on September 13, 2026. This SDK uses these older API versions. After this date, API calls to these versions will fail.","severity":"breaking","affected_versions":"<=0.9.1"},{"fix":"Always retrieve both the `VISION_KEY` and `VISION_ENDPOINT` directly from the 'Keys and Endpoint' section of your Computer Vision resource in the Azure portal and ensure they are used together. For example: `https://<your-resource-name>.cognitiveservices.azure.com/`.","message":"Client authentication requires using the correct regional endpoint URL that matches your Azure Computer Vision resource, not a global endpoint. Mismatched keys/endpoints are a common source of 401 errors.","severity":"gotcha","affected_versions":"*"},{"fix":"Always refer to the specific version's documentation. When upgrading from older versions, explicitly convert positional arguments to keyword arguments. Be aware of `enum` type comparison changes.","message":"Earlier versions (e.g., 0.2.0) introduced breaking changes by switching to keyword-only arguments for model signatures. Later changes also affected how enum types behave (using `str` mixin).","severity":"gotcha","affected_versions":"0.2.0 - 0.9.1"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Verify that your `VISION_KEY` and `VISION_ENDPOINT` environment variables (or hardcoded values, though not recommended) are correct and correspond to an active Azure Computer Vision resource. Ensure the endpoint URL exactly matches the region where the resource was deployed.","cause":"The provided subscription key is invalid, expired, or does not match the regional endpoint being used.","error":"azure.cognitiveservices.vision.computervision.models._models_py3.ComputerVisionErrorResponseException: (PermissionDenied) Access denied due to invalid subscription key or wrong API endpoint."},{"fix":"Double-check the `VISION_ENDPOINT` URL for typos. Confirm the Azure Computer Vision resource is active in the portal. Ensure the API version and path being called are valid for your resource and match the endpoint.","cause":"The endpoint URL is incorrect, the resource does not exist, or the API path/version in the URL is unsupported for your resource.","error":"azure.cognitiveservices.vision.computervision.models._models_py3.ComputerVisionErrorResponseException: (ResourceNotFound) Resource not found."},{"fix":"Ensure that images are at least 50x50 pixels. Check the file size against the API limits. For local images, consider resizing or compressing before sending.","cause":"The input image dimensions (width or height) are smaller than the minimum required size, or the image file size exceeds the allowed limit (e.g., 4MB for v3.2, 20MB for v4.0).","error":"azure.cognitiveservices.vision.computervision.models._models_py3.ComputerVisionErrorResponseException: (InvalidImageSize) Image must be at least 50 pixels in width and height."},{"fix":"Verify the image file integrity and format (e.g., JPG, PNG, BMP). If using a URL, ensure it's a direct link to the image file, not a redirect or a webpage containing the image. For local files, ensure the file stream is correctly passed.","cause":"The provided image data is corrupted, in an unsupported format, or the URL provided for a remote image does not link directly to an image file (e.g., it's a redirect or a webpage).","error":"azure.cognitiveservices.vision.computervision.models._models_py3.ComputerVisionErrorResponseException: (InvalidImageFormat) Input data is not a valid image."}],"ecosystem":"pypi"}