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

google.auth.exceptions.refreshError: #155

Closed udaf-mcq closed 3 weeks ago

udaf-mcq commented 3 weeks ago

This error was reported earlier and closed. I am not sure the solution worked. Using QGIS 3.34.12-Prizren. Here is the python error: 2024-11-01T11:04:56 WARNING Traceback (most recent call last): File "C:\Users/mquilter/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin.py", line 125, in updateLayers import ee File "C:\Users/mquilter/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin__init.py", line 42, in wrapping_ee_import__ module.Initialize(http_transport=httplib2.Http()) File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee__init__.py", line 131, in Initialize data.initialize( File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 199, in initialize _install_cloud_api_resource() File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 258, in _install_cloud_api_resource _cloud_api_resource = _cloud_api_utils.build_cloud_resource( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee_cloud_api_utils.py", line 178, in build_cloud_resource resource = build(static_discovery=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee_cloud_api_utils.py", line 162, in build return discovery.build( ^^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient_helpers.py", line 130, in positional_wrapper return wrapped(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\discovery.py", line 287, in build content = _retrieve_discovery_doc( ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\discovery.py", line 422, in _retrieve_discovery_doc resp, content = req.execute(num_retries=num_retries) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient_helpers.py", line 130, in positional_wrapper return wrapped(*args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\http.py", line 923, in execute resp, content = _retry_request( ^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\http.py", line 191, in _retry_request resp, content = http.request(uri, method, args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google_auth_httplib2.py", line 209, in request self.credentials.before_request(self._request, method, uri, request_headers) File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\auth\credentials.py", line 134, in before_request self.refresh(request) File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2\credentials.py", line 335, in refresh ) = reauth.refresh_grant( ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2\reauth.py", line 349, in refresh_grant _client._handle_error_response(response_data, retryable_error) File "C:\Users\mquilter\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\oauth2_client.py", line 69, in _handle_error_response raise exceptions.RefreshError( google.auth.exceptions.RefreshError: ('invalid_grant: Bad Request', {'error': 'invalid_grant', 'error_description': 'Bad Request'})

XavierCLL commented 3 weeks ago

Hi @udaf-mcq, the fixed version has not been released yet, try using this zip: https://github.com/gee-community/qgis-earthengine-plugin/issues/133#issuecomment-2248775157

udaf-mcq commented 3 weeks ago

After unzipping the file(s) where do I copy it to? Or is there instructions on how to do it?

Mark Quilter | Salinity Program Manager / Licensed UAV Pilot

801.201.4397 MOBILE

UTAH DEPARTMENT OF AGRICULTURE AND FOOD

https://ag.utah.gov/ https://www.facebook.com/utahagriculture https://www.instagram.com/utagandfood/ https://twitter.com/UTagandfood https://www.youtube.com/user/UtahAgriculture

How was your experience with the Utah Department of Agriculture and Food? Tell us about your experience through this 2-minute survey!

Follow this link to the survey:

Take the Survey https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

Or copy and paste the URL below into your internet browser:

https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

On Fri, Nov 1, 2024 at 11:58 AM Xavier C. Llano @.***> wrote:

Hi @udaf-mcq https://github.com/udaf-mcq, the fixed version has not been released yet, try using this zip: #133 (comment) https://github.com/gee-community/qgis-earthengine-plugin/issues/133#issuecomment-2248775157

— Reply to this email directly, view it on GitHub https://github.com/gee-community/qgis-earthengine-plugin/issues/155#issuecomment-2452330314, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCILXNCZXK4YJ522J6QUJTZ6O6NRAVCNFSM6AAAAABRAVZLZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJSGMZTAMZRGQ . You are receiving this because you were mentioned.Message ID: @.***>

XavierCLL commented 3 weeks ago

No no, you don't need to unzip that file, go to Qgis > Plugins > and use the option "install from zip" and restart Qgis after that, (also that version requires adding ee.Initialize() in your code)

udaf-mcq commented 3 weeks ago

How do you add ee.Initialize() into the code? I am sorry I am not much into programming. Do I need to open the plugin in a python IDE?

Mark Quilter | Salinity Program Manager / Licensed UAV Pilot

801.201.4397 MOBILE

UTAH DEPARTMENT OF AGRICULTURE AND FOOD

https://ag.utah.gov/ https://www.facebook.com/utahagriculture https://www.instagram.com/utagandfood/ https://twitter.com/UTagandfood https://www.youtube.com/user/UtahAgriculture

How was your experience with the Utah Department of Agriculture and Food? Tell us about your experience through this 2-minute survey!

Follow this link to the survey:

Take the Survey https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

Or copy and paste the URL below into your internet browser:

https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

On Fri, Nov 1, 2024 at 12:12 PM Xavier C. Llano @.***> wrote:

No no, you don't need to unzip that file, go to Qgis > Plugins > and use the option "install from zip" (also that version requires adding ee.Initialize() in your code)

— Reply to this email directly, view it on GitHub https://github.com/gee-community/qgis-earthengine-plugin/issues/155#issuecomment-2452351380, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCILXO3TRQP5WZZTXAC2GLZ6PACBAVCNFSM6AAAAABRAVZLZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJSGM2TCMZYGA . You are receiving this because you were mentioned.Message ID: @.***>

XavierCLL commented 3 weeks ago

add that line after import ee

udaf-mcq commented 3 weeks ago

I have installed the plugin using the install by zipfile in QGIS. I am now at the ...python\plugins\ee_plugin and see several folders and *.py files. Where do I find the line import ee?

Mark Quilter | Salinity Program Manager / Licensed UAV Pilot

801.201.4397 MOBILE

UTAH DEPARTMENT OF AGRICULTURE AND FOOD

https://ag.utah.gov/ https://www.facebook.com/utahagriculture https://www.instagram.com/utagandfood/ https://twitter.com/UTagandfood https://www.youtube.com/user/UtahAgriculture

How was your experience with the Utah Department of Agriculture and Food? Tell us about your experience through this 2-minute survey!

Follow this link to the survey:

Take the Survey https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

Or copy and paste the URL below into your internet browser:

https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

On Fri, Nov 1, 2024 at 12:20 PM Xavier C. Llano @.***> wrote:

add that line after import ee

— Reply to this email directly, view it on GitHub https://github.com/gee-community/qgis-earthengine-plugin/issues/155#issuecomment-2452363225, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCILXNTE3TUPAIKLZF6ZXDZ6PBALAVCNFSM6AAAAABRAVZLZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJSGM3DGMRSGU . You are receiving this because you were mentioned.Message ID: @.***>

XavierCLL commented 3 weeks ago

In your code not in the plugin, you don't need to change anything inside the plugin

udaf-mcq commented 3 weeks ago

I found the "import ee" on line125 of ee_plugin.py. If comes after def updateLayer(self):

Is the the correct place to insert what you sent?

Mark Quilter | Salinity Program Manager / Licensed UAV Pilot

801.201.4397 MOBILE

UTAH DEPARTMENT OF AGRICULTURE AND FOOD

https://ag.utah.gov/ https://www.facebook.com/utahagriculture https://www.instagram.com/utagandfood/ https://twitter.com/UTagandfood https://www.youtube.com/user/UtahAgriculture

How was your experience with the Utah Department of Agriculture and Food? Tell us about your experience through this 2-minute survey!

Follow this link to the survey:

Take the Survey https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

Or copy and paste the URL below into your internet browser:

https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

On Fri, Nov 1, 2024 at 12:20 PM Xavier C. Llano @.***> wrote:

add that line after import ee

— Reply to this email directly, view it on GitHub https://github.com/gee-community/qgis-earthengine-plugin/issues/155#issuecomment-2452363225, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCILXNTE3TUPAIKLZF6ZXDZ6PBALAVCNFSM6AAAAABRAVZLZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJSGM3DGMRSGU . You are receiving this because you were mentioned.Message ID: @.***>

udaf-mcq commented 3 weeks ago

Is this what I am supposed to do?

def updateLayers(self): import ee ee_Initialize() from ee_plugin.utils import add_or_update_ee_layer layers = QgsProject.instance().mapLayers().values()

Mark Quilter | Salinity Program Manager / Licensed UAV Pilot

801.201.4397 MOBILE

UTAH DEPARTMENT OF AGRICULTURE AND FOOD

https://ag.utah.gov/ https://www.facebook.com/utahagriculture https://www.instagram.com/utagandfood/ https://twitter.com/UTagandfood https://www.youtube.com/user/UtahAgriculture

How was your experience with the Utah Department of Agriculture and Food? Tell us about your experience through this 2-minute survey!

Follow this link to the survey:

Take the Survey https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

Or copy and paste the URL below into your internet browser:

https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

On Fri, Nov 1, 2024 at 12:29 PM Xavier C. Llano @.***> wrote:

In your code not in the plugin, you don't need to change anything inside the plugin

— Reply to this email directly, view it on GitHub https://github.com/gee-community/qgis-earthengine-plugin/issues/155#issuecomment-2452375517, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCILXL47RDDARHZWUZLRRDZ6PCAPAVCNFSM6AAAAABRAVZLZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJSGM3TKNJRG4 . You are receiving this because you were mentioned.Message ID: @.***>

XavierCLL commented 3 weeks ago

No, in your code not in the plugin, you don't need to change anything inside the plugin

udaf-mcq commented 3 weeks ago

I am sorry, I do not know what you mean by "your code".

Mark Quilter | Salinity Program Manager / Licensed UAV Pilot

801.201.4397 MOBILE

UTAH DEPARTMENT OF AGRICULTURE AND FOOD

https://ag.utah.gov/ https://www.facebook.com/utahagriculture https://www.instagram.com/utagandfood/ https://twitter.com/UTagandfood https://www.youtube.com/user/UtahAgriculture

How was your experience with the Utah Department of Agriculture and Food? Tell us about your experience through this 2-minute survey!

Follow this link to the survey:

Take the Survey https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

Or copy and paste the URL below into your internet browser:

https://utconcierge.qualtrics.com/jfe/form/SV_cUTRcsmWFFj4rjg

On Fri, Nov 1, 2024 at 12:37 PM Xavier C. Llano @.***> wrote:

No, in your code not in the plugin, you don't need to change anything inside the plugin

— Reply to this email directly, view it on GitHub https://github.com/gee-community/qgis-earthengine-plugin/issues/155#issuecomment-2452395505, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJCILXOXG2PV7OUYB42GN2DZ6PC57AVCNFSM6AAAAABRAVZLZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJSGM4TKNJQGU . You are receiving this because you were mentioned.Message ID: @.***>

XavierCLL commented 3 weeks ago

Ok, depends on how you want to use this plugin, through GEE python code inside the Qgis console, or through other plugins? if is the second one, I guess you don't need to do anything extra.

udaf-mcq commented 3 weeks ago

Thank you! I understand now. I us it through other plugins. I restarted GIS and have no errors or warnings. Thank you so much. Now I will try to get TreeEyed and Deepness installed since QGIS starts without any errors. Thanks for you time and help and sorry for my lack of understanding.