DefaultCredentialsError, google.api_core.exceptions.PermissionDenied 해결방법

CODEDRAGON Development/Python

반응형



 

 

 

오류메시지

google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials.

raise exceptions.DefaultCredentialsError(_HELP_MESSAGE)

google.auth.exceptions.DefaultCredentialsError: Could not automatically determine credentials. Please set GOOGLE_APPLICATION_CREDENTIALS or explicitly create credentials and re-run the application. For more information, please see https://cloud.google.com/docs/authentication/getting-started

 

 

Cloud Vision API has not been used in project xxxx before or it is disabled.

Traceback (most recent call last):

  File "C:\Python\Python36\lib\site-packages\google\api_core\grpc_helpers.py", line 57, in error_remapped_callable

    return callable_(*args, **kwargs)

  File "C:\Python\Python36\lib\site-packages\grpc\_channel.py", line 500, in __call__

    return _end_unary_response_blocking(state, call, False, None)

  File "C:\Python\Python36\lib\site-packages\grpc\_channel.py", line 434, in _end_unary_response_blocking

    raise _Rendezvous(state, None, None, deadline)

grpc._channel._Rendezvous: <_Rendezvous of RPC that terminated with (StatusCode.PERMISSION_DENIED, Cloud Vision API has not been used in project 336460447684 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/vision.googleapis.com/overview?project=3364460447684 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.)>

 

The above exception was the direct cause of the following exception:

 

Traceback (most recent call last):

  File "ex01.py", line 62, in <module>

    run_quickstart()

  File "ex01.py", line 53, in run_quickstart

    response = client.label_detection(image=image)

  File "C:\Python\Python36\lib\site-packages\google\cloud\vision_helpers\decorators.py", line 101, in inner

    response = self.annotate_image(request, retry=retry, timeout=timeout)

  File "C:\Python\Python36\lib\site-packages\google\cloud\vision_helpers\__init__.py", line 72, in annotate_image

    r = self.batch_annotate_images([request], retry=retry, timeout=timeout)

  File "C:\Python\Python36\lib\site-packages\google\cloud\vision_v1\gapic\image_annotator_client.py", line 274, in batch_annotate_images

    request, retry=retry, timeout=timeout, metadata=metadata

  File "C:\Python\Python36\lib\site-packages\google\api_core\gapic_v1\method.py", line 143, in __call__

    return wrapped_func(*args, **kwargs)

  File "C:\Python\Python36\lib\site-packages\google\api_core\grpc_helpers.py", line 59, in error_remapped_callable

    six.raise_from(exceptions.from_grpc_error(exc), exc)

  File "<string>", line 3, in raise_from

google.api_core.exceptions.PermissionDenied: 403 Cloud Vision API has not been used in project 336460447684 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/vision.googleapis.com/overview?project=3364460447684 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

 

 

 

 

 

해결방법 1

GOOGLE_APPLICATION_CREDENTIALS 환경변수 등록하시기 바랍니다.

아래 링크 참조하여 해결하세요.

 

https://codedragon.tistory.com/9406

 

 

 

 

 

 

해결방법 2

Cloud Vision API 활성화했는지 확인하시기 바랍니다.

아래 링크 참조하여 해결하세요.

 

https://codedragon.tistory.com/9362


 

 

 

해결방법 3

Google에서 인증 받은 키가 활성화되는데 시간이 걸릴 있습니다.

잠시 다시 시도해 보세요.