gee-community/qgis-earthengine-plugin

Error during installation: 'google-api-core' distribution not found

iona5 opened this issue · 9 comments

iona5 commented

During installation of the plugin i get the following error:

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

pkg_resources.DistributionNotFound: The 'google-api-core' distribution was not found and is required by the application 
Traceback (most recent call last):
  File "E:/Programs/OSGeo4Win/apps/qgis-ltr/./python\qgis\utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Users/XXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 25, in classFactory
    from .ee_plugin import GoogleEarthEnginePlugin
  File "E:/Programs/OSGeo4Win/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/XXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin.py", line 22, in 
    import ee
  File "E:/Programs/OSGeo4Win/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\XXX\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\__init__.py", line 17, in 
    from . import batch
  File "E:/Programs/OSGeo4Win/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\XXX\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\batch.py", line 15, in 
    from . import _cloud_api_utils
  File "E:/Programs/OSGeo4Win/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\XXX\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\_cloud_api_utils.py", line 22, in 
    from googleapiclient import discovery
  File "E:/Programs/OSGeo4Win/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\XXX\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\discovery.py", line 49, in 
    import google.api_core.client_options
  File "E:/Programs/OSGeo4Win/apps/qgis-ltr/./python\qgis\utils.py", line 744, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\Users\XXX\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\google\api_core\__init__.py", line 23, in 
    __version__ = get_distribution("google-api-core").version
  File "E:\Programs\OSGeo4Win\apps\Python37\lib\site-packages\pkg_resources\__init__.py", line 482, in get_distribution
    dist = get_provider(dist)
  File "E:\Programs\OSGeo4Win\apps\Python37\lib\site-packages\pkg_resources\__init__.py", line 358, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "E:\Programs\OSGeo4Win\apps\Python37\lib\site-packages\pkg_resources\__init__.py", line 901, in require
    needed = self.resolve(parse_requirements(requirements))
  File "E:\Programs\OSGeo4Win\apps\Python37\lib\site-packages\pkg_resources\__init__.py", line 787, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'google-api-core' distribution was not found and is required by the application


Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] 
QGIS version: 3.10.6-A Coruña A Coruña, ec80021f49

(updated also to 3.10.7 - same error)

when i try fix that with

python -m pip install "google-core-api"

in a qgis python console, i feel like i am getting into an installation mess i would rather try to avoid. The plugin loader is then complaining about more stuff ("google-api-python-client not found", "ee.exception not found in ee"...).

i didnt found any prerequisite documention for the installation and i feel like there is something wrong if its not a transient error.

gena commented

This is indeed a bit suspicious, try uninstalling the plugin and make sure there is nothing left of it in the QGIS plugins directory, then reinstall. This library (google-core-api) should be included in the plugin installation and picked up by the plugin automatically. What a bit suspicious if that it looks in E:\Programs\OSGeo4Win\apps\Python37\lib\site-packages and E:/Programs/OSGeo4Win/apps/qgis-ltr/. Python installations could be messed up if you change any python paths manually.

Possibly fixed with commit 8a15bd3

@iona5 and @cristhian0224 please test it using the following zip and installing it manually: https://drive.google.com/uc?export=download&id=1x8QCQ-5CzjQEk-cNEyMU87Xz5S8LaR7s

@XavierCLL Thanks for taking the time to review it, I have installed it and it works perfectly, I am very grateful, good day.

iona5 commented

Installed the ZIP file via plugin manager and at least it loads correctly and does not throw the error anymore. i can
import ee
in the python console. However the Earth Engine authentication does not work at all on my box apparently but that might be something specific over here. I will investigate that on my own.

Thanks guys for your tests, @iona5 you can test the plugin with this from ee_plugin import Map or running an example

iona5 commented

yes, sorry, that did work inside the QGIS Python console.

i however needed first to manually ee.Authenticate() via an external Python console because the plugin did not do it automatically.

i however needed first to manually ee.Authenticate() via an external Python console because the plugin did not do it automatically

the plugin should do it! open a new bug with the details (or comment if the bug has already been reported)

iona5 commented

sure, but i feel like my environment is currently so out of whack i assume there's something weird on my side. i certainly cannot provide i reasonable and reproducible bug report. I'd rather wait for the next release of this plugin an try to install that afresh. i'll report if authentication still fails then. (i would need to remove the file %USERDIR%\.config\earthengine\credentials to check this, right?)

Ah, ok I got it.

(i would need to remove the file %USERDIR%\.config\earthengine\credentials to check this, right?)

Yes