You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At submit an issue, please attached the following information of your rgee session:
You have the Python API installed (from terminal):
earthengine -h
#This worked only after I manually added the path to earthengine.exe in my anaconda3/envs/rgee/Scripts folder to my $PATH
You can find the credentials file on your system:
library(rgee)
ee_path<- path.expand("~/.config/earthengine/credentials")
file.exists(ee_path)
#Returns FALSE. There is no ".config" folder in ~, which maps to C:/Users/holtd/OneDrive/Documents#P.S. I hate that Microsoft has sneakily mapped ~ to the OneDrive folder; I never asked for this.#There *is* such a credentials file in C:/Users/holtd/.config/earthengine
file.exists("C:/Users/holtd/.config/earthengine/credentials[1] TRUE
You can run a simple EE command from R:
library(rgee)
# Initialize the Earth Engine module.
ee_Initialize()
── rgee1.1.7 ──────────────────────────────────────────────────────────────────────────────────────────────────────────── earthengine-api0.1.415 ──
✔ user:not_defined
✔ InitializingGoogleEarthEngine:DONE!Errorinvalue[[3L]](cond) :ItlookslikeyourEEcredentialhasexpired.Tryrunning ee_Authenticate() againorcleanyourcredentials ee_clean_user_credentials().
ee_Authenticate()
> ee_Authenticate()
✔ InitializingGoogleEarthEngine:Enterverificationcode:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxToauthorizeaccessneededbyEarthEngine, openthefollowingURLinawebbrowserandfollowtheinstructions.Ifthewebbrowserdoesnotstartautomatically, pleasemanuallybrowsetheURLbelow.https://code.earthengine.google.com/client-auth?scopes=https%3A//www.googleapis.com/auth/earthengine%20https%3A//www.googleapis.com/auth/cloud-platform%20https%3A//www.googleapis.com/auth/devstorage.full_control&request_id=e11tIX59KasISdm_IqvrUhWlScG00PE4X6w1uLBtRoY&tc=LTqXfxkUn7S9iwXp3Q_uiThs-On8JQi1jHNA0MdUfcg&cc=gExeK6K45XuAqeoEzLxv0mIgDDQCTz44C4Ai1LzSRwwTheauthorizationworkflowwillgenerateacode, whichyoushouldpasteintheboxbelow.
✔ InitializingGoogleEarthEngine:DONE!credentialsarecachedinthepath:C:\Users\holtd/.config/earthengine/Successfullysavedauthorizationtoken.# Print metadata for a DEM dataset.
print(ee$Image('USGS/SRTMGL1_003')$getInfo())
Errorin py_call_impl(callable, call_args$unnamed, call_args$named) :ee.ee_exception.EEException:EarthEngineclientlibrarynotinitialized.Seehttp://goo.gle/ee-auth.#There is no such website.
stop(structure(list(message="ee.ee_exception.EEException: Earth Engine client library not initialized. See http://goo.gle/ee-auth.\n\033[90mRun \033]8;;rstudio:run:reticulate::py_last_error()\a`reticulate::py_last_error()`\033]8;;\a for details.\033[39m",
call= py_call_impl(callable, call_args$unnamed, call_args$named)), class= c("ee.ee_exception.EEException",
"python.builtin.Exception", "python.builtin.BaseException", "python.builtin.object",
"error", "condition"), py_object=<environment>))
ee$Image("USGS/SRTMGL1_003")
Attach your Python (reticulate) configuration:
library(reticulate)
py_config()
python:C:/Users/holtd/anaconda3/envs/rgee/python.exelibpython:C:/Users/holtd/anaconda3/envs/rgee/python38.dllpythonhome:C:/Users/holtd/anaconda3/envs/rgeeversion:3.8.19|packagedbyconda-forge| (default, Mar202024, 12:38:07) [MSCv.192964 bit (AMD64)]
Architecture:64bitnumpy:C:/Users/holtd/anaconda3/envs/rgee/Lib/site-packages/numpynumpy_version:1.24.4ee:C:\Users\holtd\ANACON~1\envs\rgee\lib\site-packages\ee\__init__.pNOTE:PythonversionwasforcedbyRETICULATE_PYTHON
Description
I'm just trying to get some NDVI data pulled from Google Earth Engine, but I can't even get the library to work. Every time I try to access data, it keeps complaining that the Earth Engine Client Library is not initialized (whatever that means). As you can see from the above, the library tries to cache my authorization token in one location (C;/Users/holtd/.config) but then apparently searches for it in a different one ("~/.config", which is C:/Users/holtd/OneDrive/Documents/.config, which doesn't exist). I've tried copying the config file over from where it's created to where the library seems to be looking for it, but that doesn't solve the problem.
What I Did
#install.packages("rgee")
library(rgee)
require(reticulate)
# Manually installed Google Cloud SDK
HOME <- Sys.getenv("HOME")
## Set key paths
Sys.setenv("RETICULATE_PYTHON" = sprintf("%s/.local/share/r-miniconda/bin/python3", HOME))
Sys.setenv("EARTHENGINE_GCLOUD" = sprintf("%s/google-cloud-sdk/bin/", HOME))
#Install rgee Python dependencies
#ee_install()
##Asks to install Miniconda, I select Yes.
#After a lot of details prints:
#* Miniconda has been successfully installed at "C:/Users/holtd/AppData/Local/r-miniconda".
#Miniconda was successfully installed, please restart R and run again rgee::ee_install
#[1] TRUE
#I restart my R session as instructed
require(reticulate)
require(rgee)
rgee::ee_install()
#Tells me I have no Python on my system, even though it JUST INSTALLED miniconda. Okay.
rgee::ee_clean_pyenv()
rgee::ee_install_set_pyenv("C:/Users/holtd/AppData/Local/Microsoft/WindowsApps/python.exe")
EARTHENGINE_PYTHON='C:/Users/holtd/AppData/Local/Microsoft/WindowsApps/python.exe'
saved in: C:\Users\holtd\OneDrive\Documents/.Renviron
Do you want restart your R session? Windows users could need to terminate R instead of restarting.
1: yes
2: no
Selection: 1
Warning message:
In ee_install_set_pyenv_env(py_env = py_env, py_path = python_path, :
Windows users must install miniconda/anaconda to use rgee. The use of a Python environment is mandatory.
#Yeah we just installed miniconda above. Not sure why rgee thinks there isn't any.
#Manually restart R, again.
require(reticulate)
require(rgee)
> ee_install()
reticulate did not find any Python ENV on your system.
Would you like to download and install Miniconda?
Miniconda is an open source environment management system for Python.
See https://docs.conda.io/en/latest/miniconda.html for more details.
Windows users must install miniconda/anaconda to use rgee!
If you think it is an error since you know you have a Python environment
in your system. Run as follow to solve:
- Using the rgee API:
1. rgee::ee_clean_pyenv()
2. rgee::ee_install_set_pyenv(py_path = "YOUR_PYTHON_PATH_GOES_HERE")
3. Restart your system.
- Using Rstudio 1.4:
https://github.com/r-spatial/rgee/tree/help/rstudio/
Would you like to install Miniconda? [Y/n]: Y
Error: Miniconda is already installed at path "C:/Users/holtd/AppData/Local/r-miniconda".
- Use `reticulate::install_miniconda(force = TRUE)` to overwrite the previous installation.
-
#Okay, so first I get an error saying there's no Python ENV, then when I try to install Miniconda, it manages to find it!
ee_check()
Error in ee_check_python(quiet = quiet) :
Unable to find a Python version, you will need to fix before run rgee::ee_Initialize(). For more details run reticulate::py_available()
rgee::ee_Initialize()
Error in reticulate::py_discover_config() :
Python specified in RETICULATE_PYTHON (C:/Users/holtd/AppData/Local/Microsoft/WindowsApps/python.exe) does not exist
HOME <- Sys.getenv("HOME")
## Set key paths
Sys.setenv("RETICULATE_PYTHON" = sprintf("%s/.local/share/r-miniconda/bin/python3", HOME))
Sys.setenv("EARTHENGINE_GCLOUD" = sprintf("%s/google-cloud-sdk/bin/", HOME))
ee_Initialize(verbose = F)
Error in reticulate::py_discover_config() :
Python specified in RETICULATE_PYTHON (C:/Users/holtd/AppData/Local/Microsoft/WindowsApps/python.exe) does not exist
#Didn't I literally *just* set an environment variable to point this to miniconda???
Sys.getenv("RETICULATE_PYTHON")
[1] "C:\\Users\\holtd\\OneDrive\\Documents/.local/share/r-miniconda/bin/python3"
#Okay, reticulate_python is pointing to this ^^ folder...which doesn't exist!!
#Nor is there any .local folder in C:/Users/holtd
ee_Initialize(verbose = F)
Error in reticulate::py_discover_config() :
Python specified in RETICULATE_PYTHON (C:/Users/holtd/AppData/Local/Microsoft/WindowsApps/python.exe) does not exist**
#Well, this file does exist, so I'm not sure what rgee is talking about.
ee_check()
Error in ee_check_python(quiet = quiet) :
Unable to find a Python version, you will need to fix before run rgee::ee_Initialize(). For more details run reticulate::py_available()
reticulate::py_available()
[1] FALSE
#Trying to manually override reticulate python
rgee::ee_clean_pyenv()
rgee::ee_install_set_pyenv("C:/Users/holtd/anaconda3/envs/rgee/python.exe")
EARTHENGINE_PYTHON='C:/Users/holtd/anaconda3/envs/rgee/python.exe'
saved in: C:\Users\holtd\OneDrive\Documents/.Renviron
Do you want restart your R session? Windows users could need to terminate R instead of restarting.
1: yes
2: no
Selection: 2
Restart R session to see changes.
Warning message:
In ee_install_set_pyenv_env(py_env = py_env, py_path = python_path, :
Windows users must install miniconda/anaconda to use rgee. The use of a Python environment is mandatory.
Restarting R session...
# Manually restart R again
require(reticulate)
py_available()
[1] FALSE
#Alright, I give up.
The text was updated successfully, but these errors were encountered:
@bholtdwyer Please use version 0.1.3.70 of the Earth Engine API. Currently, rgee encounters errors with the latest version of the API. To upgrade the Earth Engine API, use the following function: 👇
FInally, this issue is similar to #63
The following helped me -
Run this to authenticate reticulate::py_run_string("import ee; ee.Authenticate()")
Run this to initialize... now GEE wants projects so you have to define a project - make sure you upgrade to latest GEE API (earthengine-api 0.1.416 ) - projects can be a number or ID (e.g. user/XXXX/projectname) reticulate::py_run_string("import ee; ee.Initialize(project='309736351492')")
At submit an issue, please attached the following information of your
rgee
session:Attach your Python (reticulate) configuration:
Description
I'm just trying to get some NDVI data pulled from Google Earth Engine, but I can't even get the library to work. Every time I try to access data, it keeps complaining that the Earth Engine Client Library is not initialized (whatever that means). As you can see from the above, the library tries to cache my authorization token in one location (C;/Users/holtd/.config) but then apparently searches for it in a different one ("~/.config", which is C:/Users/holtd/OneDrive/Documents/.config, which doesn't exist). I've tried copying the config file over from where it's created to where the library seems to be looking for it, but that doesn't solve the problem.
What I Did
The text was updated successfully, but these errors were encountered: