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

rgee does not "remember" the python environment #345

Open
andrew-caudillo opened this issue Aug 29, 2023 · 3 comments
Open

rgee does not "remember" the python environment #345

andrew-caudillo opened this issue Aug 29, 2023 · 3 comments

Comments

@andrew-caudillo
Copy link

andrew-caudillo commented Aug 29, 2023

rgee forgets the Python environment it installed dependencies (numpy and earthengine-api) to. When running ee_Initialize(), it suggests running ee_install(). However, reinstalling ee temporarily fixes the issue. To resolve it, you need to use reticulate to set the directory rgee expects (conda .exe file) every time you use rgee. This fix may help others with the same issue; my colleagues also encountered it.

@andrew-caudillo andrew-caudillo changed the title rgee does not "remember" that I have downloaded numpy and earthengine-api (via rgee) after about a week. rgee does not "remember" the python environment Sep 22, 2023
@andrew-caudillo
Copy link
Author

andrew-caudillo commented Nov 14, 2023

The fix I implemented in August just began to fail yesterday, 13 November 2023. I am having a very difficult time getting rgee to install. I have set the python environment, but ee_install() fails to recognize it. I had to restart my machine 3 times and terminate R about 5 times. When ee_install() finally worked, it said rgee would store the necessary files in my python environment, but then fails to recognize the environment (or that I even have python on my machine). I am confused as to why rgee fails to store the python path it used when installing in its directory or something similar.

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()

I again have to manually set the path to python before running any rgee function to fix this recurring issue. Additionally, the package will sometimes initialize without issue and other times not even initialize due to a python environment "not existing", even though it does.

@andrew-caudillo
Copy link
Author

andrew-caudillo commented Dec 8, 2023

I'm getting this error again, about a month later on 12/8/2023. I have set the environment using reticulate, I have earth engine credentials, and earthengine-api and numpy are installed in my python environment. Setting a clean py_env does not always work- it takes me about 5 tries to finally get rgee to work, but it does not result in a consistent fix. This issue is continually frustrating.

Error in ee_connect_to_py(path = ee_current_version, n = 5) :
The current Python PATH: C:/...rgee/python.exe
does not have the Python package "earthengine-api" installed. Do you restarted/terminated
your R session after install miniconda or run ee_install()?
If this is not the case, try:

ee_install_upgrade(): Install the latest Earth Engine Python version.
reticulate::use_python(): Refresh your R session and manually set the Python environment with all rgee dependencies.
ee_install(): To create and set a Python environment with all rgee dependencies.
ee_install_set_pyenv(): To set a specific Python environment.

after "successfully installing" rgee, I get this error after restarting/terminating my R session.
rgee::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()

This is the cycle I have to go through multiple times until rgee randomly does install correctly.

@andrew-caudillo
Copy link
Author

Once I closed Rstudio and re-opened, rgee does not recognize that I have numpy installed, even though it successfully installed numpy and earthengine-api a few days ago.

Error in py_module_import(module, convert = convert) :
ModuleNotFoundError: No module named 'ee'

rgee::ee_check()
(*) Python version
v [Ok] C:/Program Files/Conda/envs/rgee/python.exe v3.8
v [X] numpy not installed

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