'Google EarthEngine: No command named earthengine

I am trying to install Google EarthEngine for Python. I am following the instructions listed out in this tutorial: https://www.earthdatascience.org/tutorials/intro-google-earth-engine-python-api/.

When I run Python shell, and execute import ee, it imports Google EarthEngine without error. However, in order to use Google EarthEngine, I need to input my authentication credentials (ee.Initialize() spits out an error saying I need to do so through the command earthengine authenticate). However, when I run earthengine authenticate, I get the following error:

'earthengine' is not recognized as an internal or external command, operable program or batch file.

This seems strange, considering that earthengine is installed automatically when the Python API is installed (https://developers.google.com/earth-engine/command_line).

What I ran: py -c "import ee; ee.Initialize()"

Complete Error Message:

Traceback (most recent call last):
  File "C:\Users\windows\AppData\Local\Programs\Python\Python38-32\lib\site-packages\ee\data.py", line 230, in get_persistent_credentials
    tokens = json.load(open(oauth.get_credentials_path()))
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\windows/.config/earthengine/credentials'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\windows\AppData\Local\Programs\Python\Python38-32\lib\site-packages\ee\__init__.py", line 114, in Initialize
    credentials = data.get_persistent_credentials()
  File "C:\Users\windows\AppData\Local\Programs\Python\Python38-32\lib\site-packages\ee\data.py", line 240, in get_persistent_credentials
    raise ee_exception.EEException(
ee.ee_exception.EEException: Please authorize access to your Earth Engine account by running

earthengine authenticate

in your command line, and then retry.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source