Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ee_check_gcloud() works only for linux #351

Open
3 tasks done
rohan-pink opened this issue Nov 14, 2023 · 0 comments
Open
3 tasks done

ee_check_gcloud() works only for linux #351

rohan-pink opened this issue Nov 14, 2023 · 0 comments

Comments

@rohan-pink
Copy link

rohan-pink commented Nov 14, 2023

  • rgee version: 1.1.7
  • R version: 4.3.1
  • Operating System: Windows

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

  • You have the Python API installed (from terminal):
earthengine -h
  • 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()

# Print metadata for a DEM dataset.
print(ee$Image('USGS/SRTMGL1_003')$getInfo())

Attach your Python (reticulate) configuration:

library(reticulate)
py_config()

3.11.5

Description

ee_check_gcloud() currently works only for linux systems, not Windows.

What I Did

suggested changes to function

ee_check_gcloud <- function() {
  sysinf <- Sys.info()
  
  if (sysinf[["sysname"]] == "Windows") {
    return <- system("gcloud --help", intern = FALSE, ignore.stdout = TRUE)
    if (return != 0) {
      stop("gcloud failed [os.system('gcloud --help')]. Please check\n for any errors above and install gcloud if needed ", 
           "(https://cloud.google.com/sdk/docs/install).")
    } else {
      cat("gcloud installed and accessible on the comand line.\n")
    }  
  } else {  #Linux
    os <- reticulate::import("os")
    return <- os$system(
      "gcloud --help > /dev/null 2>&1"
    )
    if (return != 0) {
      stop(
        "gcloud failed [os.system('gcloud --help')]. Please check
      for any errors above and install gcloud if needed ",
      "(https://cloud.google.com/sdk/docs/install)."
      )
    } else {
      cat("gcloud installed and accessible on the comand line.\n")
    } 
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant