1

I am setting up a new python environment (in Windows 10) for the google earth engine python API (version 0.1.331) following the instructions detailed here. I have also installed gcloud utilities as described here. Once I have installed gcloud and activated the ee environment (with earthengine-api installed), I am able to run gcloud commands from the command line. However, when I try and run earthengine authenticate, I get an error.

The error (I've replaced my actual user directory name):

Fetching credentials using gcloud
Traceback (most recent call last):
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\site-packages\ee\oauth.py", line 291, in _load_app_default_credentials
    subprocess.run(command, check=True)
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\subprocess.py", line 505, in run
    with Popen(*popenargs, **kwargs) as process:
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\my_user_name\Miniconda3\envs\ee\Scripts\earthengine-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\site-packages\ee\cli\eecli.py", line 82, in main
    _run_command()
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\site-packages\ee\cli\eecli.py", line 61, in _run_command
    dispatcher.run(args, config)
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\site-packages\ee\cli\commands.py", line 355, in run
    self.command_dict[vars(args)[self.dest]].run(args, config)
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\site-packages\ee\cli\commands.py", line 397, in run
    ee.Authenticate(**args_auth)
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\site-packages\ee\__init__.py", line 104, in Authenticate
    return oauth.authenticate(authorization_code, quiet, code_verifier, auth_mode,
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\site-packages\ee\oauth.py", line 392, in authenticate
    _load_app_default_credentials(auth_mode == 'gcloud', scopes, quiet)
  File "C:\Users\my_user_name\Miniconda3\envs\ee\lib\site-packages\ee\oauth.py", line 294, in _load_app_default_credentials
    raise Exception('gcloud command not found. ' + tip) from e
Exception: gcloud command not found. Please ensure that gcloud is installed.
More information: https://developers.google.com/earth-engine/guides/python_install

What I've tried:

  • I've search for solutions on the stackexchange site and the user google group but have not found this particular issue.
  • I initially thought there was an issue with running oauth.py, which, at line 291, runs gcloud auth application-default login. However, if I just run that command at the commandline, it successfully launches an authorization prompt in the browser. However, when I try and run ee.Initialize() in a python session, the result is an error: No such file or directory: 'C:\\Users\\my_user_name/.config/earthengine/credentials'
  • It appears that _winapi.CreateProcess is trying to find a file that doesn't exist, but I haven't been able to figure out how to identify what file it is looking for.

1 Answer 1

3

I was able to solve this issue by rolling back to a previous version using conda install -c conda-forge earthengine-api=0.1.320. I also tested version 0.1.330 and the problem persisted so rolled back to an earlier version. Once the version was rolled back, I ran the authentication with earthengine authenticate and then updated back to the most recent api version (0.1.331). After the update, ee.Initialize() is still able to complete successfully.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.