GEE Authenticate fails

Issue #15 new
Florian Beyer created an issue

Dear Andreas,

actually everything seems to work on my machine.

QGIS 3.24.3-Tisler

EnMAP-Box 3.10.0.20220524T082114.TEST

when I choose a GEE data set, a new window opens for authentication of GEE.

When I copy the token from browser, I get the following errors:

Traceback (most recent call last):
  File "C:\Users\florian.beyer\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 223, in get_persistent_credentials
    return Credentials(None, **oauth.get_credentials_arguments())
  File "C:\Users\florian.beyer\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\oauth.py", line 71, in get_credentials_arguments
    with open(get_credentials_path()) as creds:
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\florian.beyer/.config/earthengine/credentials'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users/florian.beyer/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 37, in __wrapping_ee_import__
    _module_.Initialize(http_transport=httplib2.Http())
  File "C:\Users\florian.beyer\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\__init__.py", line 127, in Initialize
    credentials = data.get_persistent_credentials()
  File "C:\Users\florian.beyer\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 225, 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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\OSGeo4W\apps\Python39\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:\Users/florian.beyer/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 39, in __wrapping_ee_import__
    if authenticate(ee=_module_):
  File "C:\Users/florian.beyer/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 54, in authenticate
    ee.oauth._obtain_and_write_token(token.strip(), code_verifier)
  File "C:\Users\florian.beyer\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\oauth.py", line 168, in _obtain_and_write_token
    if code_verifier and ':' in code_verifier:
TypeError: a bytes-like object is required, not 'str'

The same happens, when I try to authenticate GEE in the integrated QGIS-python shell.

When I try OSGeo4w-shell (like this issue), I get an error, that gcloud is not installed, even though I install gcloud package with pip. (by the way py3_env doesn’t exist in my QGIS python installation, so far I used python3 to install packages)

Do you have an idea, what I’m doing wrong?

all the best

Florian

Comments (7)

  1. Florian Beyer reporter

    Hey… GEE is working in my browser properly. I use it somethimes for quick visualisation.

    However, I still get the error from above, when I try to start working with EE in QGIS…

  2. Andreas Rabe

    Ah ok, so Python authentification is not included, good to know.

    Ok, I tried it from the OSGeo4W console, and I get the following, which looks correct to me.

    Can you reproduce this? (Be sure to change the path to the ee_plugin folder.)

  3. Florian Beyer reporter

    unfortunately, it ends in the next error:

    gcloud is installed and I also can import the package…

  4. Andreas Rabe

    Note that you don’t need to do that in your QGIS environment, but you can install in a seperate PIP or Conda environment. After authentification, you can delete that tmp environment.

  5. Florian Beyer reporter

    I have given up for now. I’ll try it on my privat PC in the next days… Maybe the problem is related to our institutes intranet.

  6. Log in to comment