r-spatial / rgee

Google Earth Engine for R
https://r-spatial.github.io/rgee/
Other
656 stars 144 forks source link

Error in ee_Initialize() : reticulate refuse to connect with rgee in R Markdown #297

Open Memo1986 opened 1 year ago

Memo1986 commented 1 year ago

I followed the instructions from the rgee site and when I run ee_check() I get the following message, I don't know if it's related:

But it only happens to me when I try to use R Markdown,

sessionInfo() R version 4.2.1 (2022-06-23 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] rgee_1.1.5

loaded via a namespace (and not attached): [1] Rcpp_1.0.9 rstudioapi_0.14 knitr_1.40 magrittr_2.0.3 rappdirs_0.3.3
[6] lattice_0.20-45 here_1.0.1 R6_2.5.1 rlang_1.0.6 fastmap_1.1.0
[11] tools_4.2.1 grid_4.2.1 xfun_0.33 png_0.1-7 cli_3.4.1
[16] htmltools_0.5.3 crosstalk_1.2.0 rprojroot_2.0.3 yaml_2.3.5 leaflet_2.1.1
[21] digest_0.6.29 crayon_1.5.2 processx_3.7.0 Matrix_1.4-1 htmlwidgets_1.5.4
[26] ps_1.7.1 evaluate_0.16 rmarkdown_2.16 compiler_4.2.1 reticulate_1.26-9000 [31] jsonlite_1.8.2

I attach the example of R Markdown

Clasificación de Imagenes LANDSAT 5

Extraer, calsificar y mapaer datos de imagenes LANDSAT 5 para cuencas de distintas zonas climaticas.

Cargar las librerías necesarias e iniciar con la cuenta de RGEE

library(sf);
library(reticulate);
library(rgee);
library(leaflet);
library(tidyverse);
library(dplyr);
library(googledrive);
library(mapedit);
library(tmap);
library(cptcity);
library(mapview);
library(raster);
library(stars);
library(exactextractr);
library(geojson);
library(geojsonio);
library(gganimate);
library(reshape)
library(colorspace);
library(ggspatial);
library(gapminder);
library(stringr);
library(rebus);
library(lubridate);
library(plotly);
library(gifski);
library(gapminder);
library(doBy);
library(highcharter);
library(zoo);
library(tmaptools);
library(hrbrthemes);
library(ggthemes);
library(transformr);
library(cartography);
library(mapsf);
library(cartogram);
library("kableExtra");

Inicializar en RGEE

ee_Initialize(drive = TRUE)

Cargar capas de la zona de trabajo

Cargar los archivos de la zona de trabajo y guardarlo en la variables de:

cuenca_12526 <- ee$FeatureCollection("users/jorgerdzuaslp11/Cuenca_12526");

Mapear cada una de las cuencas en un solo mapa interactivo

Map$setCenter(-101.0334, 20.9583, 11);
Map$addLayer(cuenca_12526, name = "cuenca 12526");

Hopefully you can help me with this bug, thank you very much in advance.

csaybar commented 1 year ago

Hi @Memo1986 can u run rgee in a normal R script?

Memo1986 commented 1 year ago

Hello dear @cesybar, when I run an R-script, without R markdown, the Rgee library runs without problems, but when I run it with R markdown, it generates the error I mentioned.

Here is my error with R markdown image

And here it is running smoothly in an R-script image

@cesybar I really don't know why, previously I was working with Rgee in R Markdown without problems, but I formatted my pc, and installed version 4.2.1 of R and I got this error, and I already have more than a week with this problem I followed the steps of this error, to try to solve mine, but it didn't work.

Greetings and thank you very much, greetings from Mexico.