Closed MatthieuStigler closed 1 year ago
Hi @MatthieuStigler, thank you for pointing it out!
The issue was that ee_Initialize
and ee_Authenticate
have a quiet
argument with different purposes. ee_Initialize
calls internally ee_Authenticate
. Therefore, it is not possible to send the quiet argument using ...
. I added a new argument called auth_quiet
in ee_Initialize
to solve this issue.
Use ...
to use ee_Authenticate
argument in ee_Initialize
.
?ee_Initialize ?ee_Authenticate
This work in an R script (also vscode) but not if you are using Rstudio.
library(remotes)
# Install rgee
install_github("r-spatial/rgee")
# Create a Py ENV and install Py packages
rgee::ee_install()
# Install gcloud
system("curl -sSL https://sdk.cloud.google.com | bash")
Sys.setenv(PATH=sprintf("%s:%s", Sys.getenv("PATH"), sprintf("%s/google-cloud-sdk/bin/", Sys.getenv("HOME"))))
rgee::ee_Initialize(auth_quiet = TRUE)
The Rstudio console doesn't permit reply the client library.
thanks! I am now able to do the authentication, though effectively it won't work in Rstudio, needs command line (see error below).
The Rstudio problem feels like a minor issue, but see the output in case:
rgee 1.1.5 ────────────────────────────────────────────────────────────────────────── earthengine-api 0.1.317 ── ✔ user: not_defined ✔ Initializing Google Earth Engine:You are authorizing client libraries without access to a web browser. Please run the following command on a machine with a web browser and copy its output back here. Make sure the installed gcloud version is 372.0.0 or newer.
gcloud auth application-default login --remote-bootstrap=xxxx
Enter the output of the above command: ERROR: gcloud crashed (EOFError): EOF when reading a line
If you would like to report this issue, please run the following command: gcloud feedback
To check gcloud for common problems, please run the following command: gcloud info --run-diagnostics Fetching credentials using gcloud
Error in py_call_impl(callable, dots$args, dots$keywords) : Exception: gcloud failed. Please check for any errors above and install gcloud if needed.
Would it be possible that the argument
--quiet
can be used when callingee_Initialize()
, so that it runs effectivelyearthengine authenticate --quiet
?This would be very useful to allow authentication on servers. With relatively recent changes in the
earthengine
function, previous authentication does not work anymore: one needs to add--quiet
, so that it does not attempts to open a browser on the server. I believe this could solve https://github.com/r-spatial/rgee/issues/270Source: email titled Security upgrades to authentication in Python notebooks and command line on the google groups, answer by D Gib. on August 3 2022