Joke O.
Joke O.

Reputation: 599

Issues connecting to GEE from R and connecting to Chrome using RSelenium

I recently tried configuring my R environment to connect to GEE directly from my desktop. I have certain consistent issues and don't know why. I could connect to a website through Rselenium before I started tampering with stuff to get rgee to connect. What could be wrong and how do I fix it? Even when I set the correct gcs credentials, it still doesn't find it. The path to python on my system is defined this way when I call it through the reticulate library:

library(reticulate)
library(rgee)
Sys.which("python") 
"C:\\Users\\Myname\\AppData\\Local\\MICROS~1\\WINDOW~1\\python.exe"

use_python(Sys.which("python3"))  

Error in use_python(Sys.which("python3")) : 
Specified version of python 'C:\Users\Myname\AppData\Local\MICROS~1\WINDOW~1\python3.exe' does not exist.

Most tutorials online show a Python path with a different structure. Now, even when I try to initialize, I have issues:

ee_Initialize(user = '[email protected]', drive = TRUE, gcs = T)

── rgee 1.1.5 ────────────────────────────────────────────────── earthengine-api 0.1.339 ── 
 ✔ user: [email protected] 
 ✔ Google Drive credentials:Auto-refreshing stale OAuth token.
 ✔ Google Drive credentials:  FOUND
 ✔ GCS credentials: NOT FOUND
 ✔ Initializing Google Earth Engine:Fetching credentials using gcloud
Error: Exception: gcloud failed. Please check for any errors above.
*Possible fixes: If you loaded a page with a "redirect_uri_mismatch" error, run earthengine authenticate with the --quiet flag; if the error page says "invalid_request", be sure to run the entire gcloud auth command that is shown.
More information: https://developers.google.com/earth-engine/guides/python_install

How do I set my python path to something like this (which is written in most rgee tutorials):

 /usr/local/bin/python3

P.S. I have 3 different versons of Python installed (including version 3.10) on my system for ArcGIS pro and Desktop. I also have anaconda that came with the ESRI environment (I am scared of tampering with it). Also, how do I fix the new challenges with connecting through rselenium to other websites?

library(stringr)
library(RSelenium)
library(dplyr)

rd <- rsDriver(chromever = "110.0.5481.77",browser = "chrome", port = 9515L) 
remDr <- rd$client
remDr$open()
[1] "Connecting to remote server"
Error in checkError(res) : 
 Undefined error in httr call. httr output: Failed to connect to localhost port 4800: Connection refused

I saw a suggestion to use Docker to connect and then scrape behind an iframe but will it work on Windows 10? If yes, how do I use it?

Upvotes: 1

Views: 320

Answers (0)

Related Questions