Azure-Samples / azure-ai-vision-sdk

SDK for Microsoft's Azure AI Vision
MIT License
84 stars 50 forks source link

ImageAnalysisErrorReason.CONNECTION_FAILURE, Error code: 3 #43

Closed Schnubbeldibuh closed 1 year ago

Schnubbeldibuh commented 1 year ago

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Problem: Tried Image Analysis 4.0 preview Version (https://learn.microsoft.com/en-us/azure/ai-services/computer-vision/quickstarts-sdk/image-analysis-client-library-40?tabs=visual-studio%2Clinux&pivots=programming-language-python) and sdk in import azure.ai.vision as sdk doesn't work in Jupyter Notebook on Jupyter Container but it works as a curl command.

Ran the code with an URL and a local image from https://github.com/Azure-Samples/azure-ai-vision-sdk/blob/main/samples/python/image-analysis/samples.py Used the right format for endpoint: https://<your-computer-vision-resource-name>.cognitiveservices.azure.com - like described in https://github.com/Azure-Samples/azure-ai-vision-sdk/tree/main/samples/python/image-analysis#troubleshooting The api key and resource is also valid and works with Version 3.2 and with the following request tool https://eastus.dev.cognitive.microsoft.com/docs/services/unified-vision-apis-public-preview-2023-04-01-preview/operations/61d65934cd35050c20f73ab6/console Also works on shell with a random picture URL:

curl -H "Host: https://<your-computer-vision-resource-name>.cognitiveservices.azure.com" -H "Ocp-Apim-Subscription-Key: $(pbpaste)" -H "Content-Type: application/json" -d '{"url": "https://www.kinderfunkkolleggeld.de/application/files/5214/4476/9885/Wie_entstehen_Preise.jpg"}' "https://<your-computer-vision-resource-name>.cognitiveservices.azure.com/computervision/imageanalysis:analyze?api-version=2023-02-01-preview&features=read&language=de&gender-neutral-caption=False"

Any log messages given by the failure

With local image as input:

Analysis failed.
   Error reason: ImageAnalysisErrorReason.CONNECTION_FAILURE
   Error code: 3
   Error message: Failed with error: HTTPAPI_OPEN_REQUEST_FAILED [0x3 | 2550]
POST https://<your-computer-vision-resource-name>.cognitiveservices.azure.com/computervision/imageanalysis:analyze?api-version=2023-02-01-preview&features=read&language=de

With URL as input:

Analysis failed.
   Error reason: ImageAnalysisErrorReason.CONNECTION_FAILURE
   Error code: 3
   Error message: Failed with error: HTTPAPI_OPEN_REQUEST_FAILED [0x3 | 2550]
POST https://<your-computer-vision-resource-name>.cognitiveservices.azure.com/computervision/imageanalysis:analyze?api-version=2023-02-01-preview&features=caption%2Cread&gender-neutral-caption=false&language=de

Expected/desired behavior

For URL:

{"readResult":{"stringIndexType":"TextElements","content":"10 ,- €\n2,50 €\n4,80 €","pages":[{"height":500.0,"width":500.0,"angle":-7.1313,"pageNumber":1,"words":[{"content":"10","boundingBox":[235.0,155.0,266.0,156.0,265.0,192.0,234.0,191.0],"confidence":0.998,"span":{"offset":0,"length":2}},{"content":",-","boundingBox":[273.0,156.0,297.0,156.0,296.0,192.0,272.0,192.0],"confidence":0.994,"span":{"offset":3,"length":2}},{"content":"€","boundingBox":[304.0,156.0,325.0,157.0,325.0,193.0,304.0,192.0],"confidence":0.995,"span":{"offset":6,"length":1}},{"content":"2,50","boundingBox":[89.0,300.0,159.0,291.0,163.0,329.0,94.0,338.0],"confidence":0.991,"span":{"offset":8,"length":4}},{"content":"€","boundingBox":[167.0,290.0,191.0,289.0,196.0,325.0,172.0,328.0],"confidence":0.989,"span":{"offset":13,"length":1}},{"content":"4,80","boundingBox":[307.0,298.0,377.0,287.0,383.0,324.0,313.0,335.0],"confidence":0.991,"span":{"offset":15,"length":4}},{"content":"€","boundingBox":[385.0,286.0,406.0,284.0,412.0,319.0,391.0,322.0],"confidence":0.996,"span":{"offset":20,"length":1}}],"spans":[{"offset":0,"length":21}],"lines":[{"content":"10 ,- €","boundingBox":[233.0,155.0,331.0,157.0,330.0,193.0,233.0,191.0],"spans":[{"offset":0,"length":7}]},{"content":"2,50 €","boundingBox":[88.0,301.0,197.0,289.0,200.0,323.0,93.0,338.0],"spans":[{"offset":8,"length":6}]},{"content":"4,80 €","boundingBox":[307.0,299.0,412.0,284.0,417.0,317.0,311.0,335.0],"spans":[{"offset":15,"length":6}]}]}],"styles":[],"modelVersion":"2022-04-30"},"modelVersion":"2023-02-01-preview","metadata":{"width":500,"height":500}}%

Or result for local images.

OS and Version?

Used a Jupyter Container because the pip azure-ai-vision package doesn't comply with macOS so far. PRETTY_NAME="Ubuntu 22.04.2 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.2 LTS (Jammy Jellyfish)"

Versions

Python 3.9.17 azure-ai-vision 0.13.0b1

Mention any other details that might be useful

Already read this issue: https://github.com/Azure-Samples/azure-ai-vision-sdk/issues/40 Created a docker file where the version openssl-1.1.1u was already patched.


Thanks! We'll be in touch soon.

dargilco commented 1 year ago

@Schnubbeldibuh, Thank you for the detailed description of your issue! Is the Jupyter Container running as an Ubuntu VM on a macOS machine?

Schnubbeldibuh commented 1 year ago

@dargilco we ran jupyter notebook in docker linux mode by setting export DOCKER_DEFAULT_PLATFORM=linux/amd64 to force docker to emulate a underlying linux platform

dargilco commented 1 year ago

on a macOS machine?

Schnubbeldibuh commented 1 year ago

@dargilco yes

dargilco commented 1 year ago

@Schnubbeldibuh we have not tested this scenario so I cannot comment. We do not yet support Python on macOS, and I'm not sure what to expect from a Jupyter Ubuntu Container running on macOS. So unfortunately, at the moment I don't have a solution for you. We will support macOS in one of our next releases and I took note to test a Jupyter Ubuntu Container when we do. I am closing this issue.