gee-community / qgis-earthengine-plugin

Integrates Google Earth Engine and QGIS using Python API
http://qgis-ee-plugin.appspot.com
MIT License
454 stars 116 forks source link

GEE Authentication problem when re-installing the plugin #61

Closed herrtunante closed 4 years ago

herrtunante commented 4 years ago

Dear Genna,

I have uninstalled the old version 0.0.1 and installed the new one 0.0.2

I immediately get this error in the pop-up window:

Couldn't load plugin 'ee_plugin' due to an error when calling its classFactory() method

google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', '{\n "error": "invalid_grant",\n "error_description": "Token has been expired or revoked."\n}') Traceback (most recent call last): File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin plugins[packageName] = package.classFactory(iface) File "C:/Users/Alfonso Sanchez-Paus/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin__init.py", line 25, in classFactory from .ee_plugin import GoogleEarthEnginePlugin File "C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python\qgis\utils.py", line 744, in _import mod = _builtin_import(name, globals, locals, fromlist, level) File "C:/Users/Alfonso Sanchez-Paus/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin.py", line 26, in ee_plugin.ee_auth.init() File "C:/Users/Alfonso Sanchez-Paus/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 19, in init ee.Initialize() File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\init__.py", line 123, in Initialize http_transport=http_transport) File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 210, in initialize _install_cloud_api_resource() File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 287, in _install_cloud_api_resource http_transport=_http_transport) File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee_cloud_api_utils.py", line 149, in build_cloud_resource model=alt_model) File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient_helpers.py", line 134, in positional_wrapper return wrapped(*args, **kwargs) File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\discovery.py", line 246, in build requested_url, discovery_http, cache_discovery, cache, developerKey File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\discovery.py", line 305, in _retrieve_discovery_doc resp, content = http.request(actual_url) File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google_auth_httplib2.py", line 187, in request self._request, method, uri, request_headers) File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\auth\credentials.py", line 124, in before_request self.refresh(request) File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2\credentials.py", line 183, in refresh self._scopes, File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2_client.py", line 248, in refresh_grant response_data = _token_endpoint_request(request, token_uri, body) File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2_client.py", line 124, in _token_endpoint_request _handle_error_response(response_body) File "C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2_client.py", line 60, in _handle_error_response raise exceptions.RefreshError(error_details, response_body) google.auth.exceptions.RefreshError: ('invalid_grant: Token has been expired or revoked.', '{\n "error": "invalid_grant",\n "error_description": "Token has been expired or revoked."\n}')

Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS version: 3.12.1-București București, 121cc00ff0

Python Path: C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python C:/Users/Alfonso Sanchez-Paus/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:/Users/Alfonso Sanchez-Paus/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python/plugins C:\PROGRA~1\QGIS3~1.12\apps\Python37 C:\PROGRA~1\QGIS3~1.12\apps\Python37\Scripts C:\Program Files\QGIS 3.12\bin\python37.zip C:\PROGRA~1\QGIS3~1.12\apps\Python37\DLLs C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib C:\Program Files\QGIS 3.12\bin C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\win32 C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\win32\lib C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\site-packages\Pythonwin C:/Users/Alfonso Sanchez-Paus/AppData/Roaming/QGIS/QGIS3\profiles\default/python C:\Users\Alfonso Sanchez-Paus\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows

herrtunante commented 4 years ago

Ok, I don't know exactly what was wrong but it got fixed.

I uninstalled the Plugin In the comand line I updated my GEE Python package with pip. I then did from the cmd line ee.Authenticate() I reinstalled the plugin

Examples are working fine!

Sorry to bother. /Alfonso

gena commented 4 years ago

Glad you had this fixed. That looks like the EE auth issue, it simply means that you need to re-authenticate via command-line (outside of QGIS): earthengine authenticate.

Chaz6 commented 4 years ago

I have the same issue but I could not resolve it, I would appreciate some help. This is what I tried so far:-

image image

nafisehkakhani commented 2 years ago

@Chaz6 you need to install EarthEngine Python API first.