rgee icon indicating copy to clipboard operation
rgee copied to clipboard

Evaluation error: google.auth.exceptions.RefreshError

Open barrakat opened this issue 2 years ago • 4 comments

  • rgee version: 1.1.5
  • R version: 4.0.0
  • Operating System: CentOS7

At submit an issue, please attached the following information of your rgee session:

  • [x] You have the Python API installed (from terminal):
earthengine -h
  • [x] You can find the credentials file on your system:
library(rgee)
ee_path <- path.expand("~/.config/earthengine/credentials")
file.exists(ee_path)
  • [ ] You can run a simple EE command from R:
library(rgee)

# Initialize the Earth Engine module.
ee_Initialize()

── rgee 1.1.5 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── earthengine-api 0.1.367 ── 
 ✔ user: not_defined
 ✔ Initializing Google Earth Engine:Error in py_call_impl(callable, call_args$unnamed, call_args$named) : 
  google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'})
Run `reticulate::py_last_error()` for details.

Attach your Python (reticulate) configuration:

library(reticulate)
py_config()

python:         /gpfs1/schlecker/home/barrasso/.local/share/r-miniconda/envs/r-reticulate/bin/python
libpython:      /gpfs1/schlecker/home/barrasso/.local/share/r-miniconda/envs/r-reticulate/lib/libpython3.9.so
pythonhome:     /gpfs1/schlecker/home/barrasso/.local/share/r-miniconda/envs/r-reticulate:/gpfs1/schlecker/home/barrasso/.local/share/r-miniconda/envs/r-reticulate
version:        3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:49:32)  [GCC 12.3.0]
numpy:           [NOT FOUND]
ee:             /gpfs1/schlecker/home/barrasso/.local/share/r-miniconda/envs/r-reticulate/lib/python3.9/site-packages/ee

Description

ee_Authenticate() works but ee_Initialize() doesn't, and I don't know what's wrong

What I Did

library(rgee)
ee_Initialize()

── rgee 1.1.5 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── earthengine-api 0.1.367 ── 
 ✔ user: not_defined
 ✔ Initializing Google Earth Engine:Error in py_call_impl(callable, call_args$unnamed, call_args$named) : 
  google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'})
Run `reticulate::py_last_error()` for details.

barrakat avatar Sep 07 '23 11:09 barrakat

After a few years without using rgee, I tried installing it to run some codes, and got the same error on my machine. See picture below.

image

ricds avatar Sep 19 '23 06:09 ricds

Hi seems like the credentials expired. you can easily get new ones with ee_Authenticate. Let me know if that works!

csaybar avatar Sep 19 '23 09:09 csaybar

authenticate gives me this error

image

ricds avatar Sep 19 '23 09:09 ricds

Hi @ricds can u upgrade your rgee version using GH. New rgee version use 'notebook' rather than 'gcloud' to auth (similar to geemap).

remotes::install_github("r-spatial/rgee")

csaybar avatar Sep 19 '23 09:09 csaybar