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

syntax or compile error on trying to call authentication for plugin on qgis 3.16? #76

Closed BrawlPups closed 3 years ago

BrawlPups commented 3 years ago

Here are various traces when trying command in python console qgis to authenticate. There was not a pop up for authentication at anypoint after plugin installation so I tried the python editor which aslo did not work for me. This is on windows 10 with QGIS 3.6 and I have bitdefender if that matters.

2020-12-12T15:50:42 CRITICAL Traceback (most recent call last): File "C:\Users\lewis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\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\lewis/.config/earthengine/credentials'

         During handling of the above exception, another exception occurred:

         Traceback (most recent call last):
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 19, in init
          ee.Initialize()
          File "C:\Users\lewis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\__init__.py", line 114, in Initialize
          credentials = data.get_persistent_credentials()
          File "C:\Users\lewis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 241, in get_persistent_credentials
          'Please authorize access to your Earth Engine account by '
         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:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
          plugins[packageName] = package.classFactory(iface)
          File "C:/Users/lewis/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.16/apps/qgis/./python\qgis\utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin.py", line 26, in 
          ee_plugin.ee_auth.init()
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 21, in init
          authenticate()
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 32, in authenticate
          auth_url = ee.oauth.get_authorization_url()
         TypeError: get_authorization_url() missing 1 required positional argument: 'code_challenge'

2020-12-12T15:55:08 CRITICAL Traceback (most recent call last): File "C:\Users\lewis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\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\lewis/.config/earthengine/credentials'

         During handling of the above exception, another exception occurred:

         Traceback (most recent call last):
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 19, in init
          ee.Initialize()
          File "C:\Users\lewis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\__init__.py", line 114, in Initialize
          credentials = data.get_persistent_credentials()
          File "C:\Users\lewis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 241, in get_persistent_credentials
          'Please authorize access to your Earth Engine account by '
         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:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
          plugins[packageName] = package.classFactory(iface)
          File "C:/Users/lewis/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.16/apps/qgis/./python\qgis\utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin.py", line 26, in 
          ee_plugin.ee_auth.init()
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 21, in init
          authenticate()
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 32, in authenticate
          auth_url = ee.oauth.get_authorization_url()
         TypeError: get_authorization_url() missing 1 required positional argument: 'code_challenge'

2020-12-12T15:55:27 CRITICAL Traceback (most recent call last): File "C:\Users\lewis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\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\lewis/.config/earthengine/credentials'

         During handling of the above exception, another exception occurred:

         Traceback (most recent call last):
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 19, in init
          ee.Initialize()
          File "C:\Users\lewis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\__init__.py", line 114, in Initialize
          credentials = data.get_persistent_credentials()
          File "C:\Users\lewis\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 241, in get_persistent_credentials
          'Please authorize access to your Earth Engine account by '
         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:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
          plugins[packageName] = package.classFactory(iface)
          File "C:/Users/lewis/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.16/apps/qgis/./python\qgis\utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin.py", line 26, in 
          ee_plugin.ee_auth.init()
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 21, in init
          authenticate()
          File "C:/Users/lewis/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 32, in authenticate
          auth_url = ee.oauth.get_authorization_url()
         TypeError: get_authorization_url() missing 1 required positional argument: 'code_challenge'
gena commented 3 years ago

So, did you try running earthengine authenticate in your command-line? Not in QGIS but after installing earthengine-api as a usual python package. Then restart QGIS again with EE plugin installed.

XavierCLL commented 3 years ago

Hi, this error was fixed (but not released yet) please test it using the following zip and installing it manually: https://drive.google.com/uc?export=download&id=1x8QCQ-5CzjQEk-cNEyMU87Xz5S8LaR7s

gena commented 3 years ago

This should be fixed by #71 please reinstall the plugin to v0.0.3

GopherGT commented 3 years ago

This appears to still be an issue. Installing GEE 0.0.3 on QGIS 3.16

ee.Authenticate() in the Python console produces the following.

The authorization workflow will generate a code, which you should paste in the box below. Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in File "C:\Users... \AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\oauth.py", line 233, in authenticate _obtain_and_write_token(None, code_verifier) # Will prompt for auth_code. File "C:\Users... \AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\oauth.py", line 137, in _obtain_and_write_token auth_code = input('Enter verification code: ') RuntimeError: input(): lost sys.stdin

XavierCLL commented 3 years ago

Hi, run in the Python console in Qgis ee_plugin import Map or run earthengine authenticate in an ordinary python console (not in the QGIS python console)