Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Vision API - tatusCode.RESOURCE_EXHAUSTED

Tags:

gcloud

I am new to the Google Vision API and I would like to conduct a label detection of approx. 10 images and I would like to run the vision quickstart.py file. However when I do this with only 3 images then it is successful. With more than 3 images I am getting the error message below. I know that I would need to change something at my setup, but I do not know what I should change.

Here is my error message:

google.gax.errors.RetryError: GaxError(Exception occurred in retry method 
that was not classified as transient, caused by <_Rendezvous of RPC that 
terminated with (StatusCode.RESOURCE_EXHAUSTED, Insufficient tokens for 
quota 'DefaultGroup' and limit 'USER-100s' of service 
'vision.googleapis.com' for consumer 'project_number: XXX'.)>)

Does anybody know what I need to do?

Any help would be much appreciated

Cheers, Andi

like image 429
Andi Maier Avatar asked Aug 06 '26 20:08

Andi Maier


1 Answers

I ran into the same problem and fixed it with these steps:

  1. Make sure you have the Google Cloud SDK properly installed: https://cloud.google.com/vision/docs/reference/libraries
  2. Setup a Service Account in the Google Cloud backend: https://developers.google.com/identity/protocols/OAuth2ServiceAccount#creatinganaccount
  3. Create a Service Account Key and download it as a JSON file to a local folder. You need to keep the key private.
  4. Export the filepath to the key-file as an environment variable: gcloud auth activate-service-account --key-file path/to/your/keyfile/here
  5. Log out/in of the console.
  6. Make sure, the environment variable is properly set with printenv
  7. Try your py-script again...

Good luck...

Edit: In addition to the mentioned steps 1.-3. you can just do vision_client = vision.Client.from_service_account_json('/path/to/your/keyfile.json') in your script. No need for the env variable then.

like image 93
petezurich Avatar answered Aug 09 '26 23:08

petezurich



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!