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

ERROR: gcloud command not found. Please ensure that gcloud is installed. #145

Closed haoweiduan closed 7 months ago

haoweiduan commented 7 months ago

After installing the gcloud SDK, I ran the following command and got a "ERROR: gcloud command not found. Please ensure that gcloud is installed."error. import ee ee.Authenticate() service_account = 'my-earth@my-project.iam.gserviceaccount.com' credentials = ee.ServiceAccountCredentials(service_account, './my-project-1111cceb213b.json') ee.Initialize(credentials) When I comment out "ee.Authenticate()" and run print(ee.String('Hello World from EE!').getInfo()), I got "ee.ee_exception.EEException: Project 'projects/xxx' not found or deleted." but the same code works in python geemap, I'm confused where the problem is. (windows11 QGIS3.34.5 Python 3.9 Google Earth Engine 0.0.6)

XavierCLL commented 7 months ago

Hi @haoweiduan

This is a new requirement in the GEE API, you need to run ee.Initialize(project=my-project) with a project, check this related issue #143

haoweiduan commented 7 months ago

Hi @haoweiduan

This is a new requirement in the GEE API, you need to run ee.Initialize(project=my-project) with a project, check this related issue #143 I have tried ee.Authenticate() ee.Initialize(project='my-project') but I got "ee.ee_exception.EEException: Not signed up for Earth Engine or project is not registered."

XavierCLL commented 7 months ago

have you created your 'my-project'? check the links and docs

haoweiduan commented 7 months ago

When I executed the code, I replaced my project name with “my-project” console shows "QGIS EE Plugin authenticated successfully". But then the following error message was displayed: raceback (most recent call last): File "C:\Users\xxx\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 326, in _execute_cloud_call return call.execute(num_retries=num_retries) File "C:\Users\xxx\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\xxx\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\http.py", line 938, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 403 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/algorithms?prettyPrint=false&alt=json returned "Not signed up for Earth Engine or project is not registered. Visit https://developers.google.com/earth-engine/guides/access". Details: "Not signed up for Earth Engine or project is not registered. Visit https://developers.google.com/earth-engine/guides/access">

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users/xxx/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\xxx\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee__init__.py", line 140, in Initialize ApiFunction.initialize() File "C:\Users\xxx\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\apifunction.py", line 154, in initialize signatures = data.getAlgorithms() File "C:\Users\xxx\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 1128, in getAlgorithms return _cloud_api_utils.convert_algorithms(_execute_cloud_call(call)) File "C:\Users\xxx\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 328, in _execute_cloud_call raise _translate_cloud_exception(e) ee.ee_exception.EEException: Not signed up for Earth Engine or project is not registered. Visit https://developers.google.com/earth-engine/guides/access

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\xxx\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 326, in _execute_cloud_call return call.execute(num_retries=num_retries) File "C:\Users\xxx\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\xxx\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\http.py", line 938, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 403 when requesting https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/algorithms?prettyPrint=false&alt=json returned "Not signed up for Earth Engine or project is not registered. Visit https://developers.google.com/earth-engine/guides/access". Details: "Not signed up for Earth Engine or project is not registered. Visit https://developers.google.com/earth-engine/guides/access">

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\QGIS\apps\Python39\lib\code.py", line 90, in runcode exec(code, self.locals) File "", line 1, in File "", line 4, in File "C:\Users/duanhaowei/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin__init.py", line 46, in wrapping_ee_import__ module.Initialize(http_transport=httplib2.Http()) File "C:\Users\duanhaowei\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee__init__.py", line 140, in Initialize ApiFunction.initialize() File "C:\Users\duanhaowei\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\apifunction.py", line 154, in initialize signatures = data.getAlgorithms() File "C:\Users\duanhaowei\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 1128, in getAlgorithms return _cloud_api_utils.convert_algorithms(_execute_cloud_call(call)) File "C:\Users\duanhaowei\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 328, in _execute_cloud_call raise _translate_cloud_exception(e) ee.ee_exception.EEException: Not signed up for Earth Engine or project is not registered. Visit https://developers.google.com/earth-engine/guides/access

XavierCLL commented 7 months ago

I think I fixed it but we have not released it yet, please reinstall the plugin using the artifact described in https://github.com/gee-community/qgis-earthengine-plugin/issues/133#issuecomment-2022726154

Please let me know if that fixes your error

haoweiduan commented 7 months ago

I think I fixed it but we have not released it yet, please reinstall the plugin using the artifact described in #133 (comment)

Please let me know if that fixes your error

I have reinstalled the plugin,when I import ee a new error message was displayed : Traceback(most recent call last): File "D:\QGIS\apps\Python39\lib\code.py", line 90, in runcode exec(code, self.locals) File "<input>", line 1, in <module> File "<string>", line 4, in <module> File "D:\QGIS/apps/qgis-ltr/./python\qgis\utils.py", line 892, in _import mod = _builtin_import(name, globals, locals, fromlist, level) ModuleNotFoundError: No module named 'ee'

XavierCLL commented 7 months ago

have you restarted Qgis after installing the plugin? (that is necessary)

haoweiduan commented 7 months ago

have you restarted Qgis after installing the plugin? (that is necessary)

Of course, I tried to restart it three times.

XavierCLL commented 7 months ago

I found an error in the Artifacts zip, one second...

XavierCLL commented 7 months ago

@haoweiduan The solution is waiting in a PR, meanwhile the easiest method is open the zip, change the directory name "extlibs_linux" to "extlibs_windows", zip it again and install it

haoweiduan commented 7 months ago

我想我修复了它,但我们还没有发布它,请使用 #133 中描述的工件重新安装插件 (评论)

如果这解决了您的错误,请告诉我

I have reinstall

@haoweiduan The solution is waiting in a PR, meanwhile the easiest method is open the zip, change the directory name "extlibs_linux" to "extlibs_windows", zip it again and install it

It works, that's cool. Thanks a lot!