Skip to content

Unable to ee_Initialize() because legacy asset directory already exists #361

@dendroica

Description

@dendroica
  • rgee version: 1.1.7
  • R version: 4.1.2
  • Operating System: Ubuntu

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()
python:         /home/jess/miniconda3/envs/myend/bin/python
libpython:      /home/jess/miniconda3/envs/myend/lib/libpython3.10.so
pythonhome:     /home/jess/miniconda3/envs/myend:/home/jess/miniconda3/envs/myend
version:        3.10.14 (main, Mar 21 2024, 16:24:04) [GCC 11.2.0]
numpy:          /home/jess/miniconda3/envs/myend/lib/python3.10/site-packages/numpy
numpy_version:  1.26.4
ee:             /home/jess/.local/lib/python3.10/site-packages/ee

NOTE: Python version was forced by RETICULATE_PYTHON

Description

I am still having trouble getting ee_Initialize() to setup the environment correctly, including connecting to my Google Drive (I think). I worked around it (below).

What I Did

Given in part the extensive needs for workarounds at this time, I setup my own conda environment and installed the older version of the earth engine API. I created the rgee_sessioninfo.txt manually from an old issue with the following contents:

"user" "drive_cre" "gcs_cre"
"my google username" "path to my credential file" NA

Secondly, I try to run this:

library(rgee)
ee$Initialize(project='my base project')
ee_Initialize(user="my google username", drive=T)

The above gets "stuck" because my legacy asset folder already exists...it asks me for the desired name of the folder, and I enter it, and it tells me it already exists. Entering another name after "user/" does nothing and it just keeps reminding me that the prior named folder is already there. This doesn't make sense to me, given that the message says you can exit the process and create it yourself. It seems like some credential is misaligned somewhere, but given all of the trouble with initializing and authentication, I'm not sure where to close the loop. Here is the error:

Please insert the desired name of your root folder : users/jessicagorzo
ee.ee_exception.EEException: User home folder already exists: "projects/earthengine-legacy/assets/users/jessicagorzo". If you have problems creating the ROOT folder use the Earth Engine Code Editor. 
>>> https://code.earthengine.google.com/
>>> https://raw.githubusercontent.com/csaybar/GCS_AUTH_FILE.json/master/asset_folder.png

Manually creating the rgee_sessioninfo.txt file and pointing it to the generated credential file seems to work, but you need to keep a copy of it and move into the directory every time, I'm assuming to compensate for ee_Initialize() being buggy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions