Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

couldn't activate the plugin #66

Closed
M-Rezvanpour opened this issue Aug 5, 2020 · 18 comments
Closed

couldn't activate the plugin #66

M-Rezvanpour opened this issue Aug 5, 2020 · 18 comments

Comments

@M-Rezvanpour
Copy link

M-Rezvanpour commented Aug 5, 2020

Hi,
I just installed the plugin but when I wanted to activate it, I faced this error:

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

TypeError: get_authorization_url() missing 1 required positional argument: 'code_challenge' 
Traceback (most recent call last):
  File "C:\Users\javad\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\\javad/.config/earthengine/credentials'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 19, in init
    ee.Initialize()
  File "C:\Users\javad\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\javad\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.12/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Users/javad/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/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin.py", line 26, in 
    ee_plugin.ee_auth.init()
  File "C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 21, in init
    authenticate()
  File "C:/Users/javad/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'


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.0-București București, cd141490ec 

Python Path:
C:/PROGRA~1/QGIS3~1.12/apps/qgis/./python
C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/javad/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:\PROGRA~1\QGIS3~1.12\bin\python37.zip
C:\PROGRA~1\QGIS3~1.12\apps\Python37\DLLs
C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib
C:\PROGRA~1\QGIS3~1.12\bin
C:\Users\javad\AppData\Roaming\Python\Python37\site-packages
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/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis2web
C:\Users\javad\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins
C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgis_resource_sharing
C:\Users\javad\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\qgis_resource_sharing
C:\Users\javad\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\qgis_resource_sharing\ext_libs
.
D:/javad/Documents/Work/hydrotech toos/QuickOSM-municipality
C:\Users\javad\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows
@XavierCLL
Copy link
Collaborator

Hi, this error was fixed in #62 (but not released yet), use the zip attached in this comment #62 (comment)

@M-Rezvanpour
Copy link
Author

Thanks, problem solved
but now every time when I want to run a script, a new earth engine authentication window opens in my browser to allow the earth engine.
After I clicking on the allow button, a code shows but I don't know where to put it in the plugin (it's something like the API code)

@XavierCLL
Copy link
Collaborator

If the plugin ask about the earth engine auth if because you haven't completed the authentication process for the plugin, copy the earth engine code in the window that plugin open for it

@M-Rezvanpour
Copy link
Author

for instance, the code below:

import ee
from ee_plugin import Map

# traditional python string
print('Hello world!')

# Earth Eninge object
print(ee.String('Hello World from Earth Engine!').getInfo())
print(ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20140318').getInfo())

how can I complete the authentication process? should I dot it in the code or can I do it through the plugin? because I didn't see any config option for this in the plugin's options

@XavierCLL
Copy link
Collaborator

When you run it that code, the plugin should open a dialog like this, copy in that entry the auth access code

dialog

@M-Rezvanpour
Copy link
Author

this dialog doesn't show up!

@XavierCLL
Copy link
Collaborator

XavierCLL commented Aug 5, 2020

sure? it should open a dialog, else it is a bug

@M-Rezvanpour
Copy link
Author

yeah, I'm using QGIS version 3.12.0
and I just installed the plugin using the zip file you said earlier

@XavierCLL
Copy link
Collaborator

XavierCLL commented Aug 5, 2020

but the web page to authorization opens automatically? can you see any error in Qgis? please restart Qgis and try again

@M-Rezvanpour
Copy link
Author

yes, web page opens
here's the error:

Google Earth Engine Authorization:
If the web browser does not start automatically, start it manually and open the following URL:
"https://accounts.google.com/o/oauth2/auth?client_id=517222506229-vsmmajv00ul0bs7p89v5m89qs8eb9359.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fearthengine+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdevstorage.full_control&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&code_challenge=XbWOxJmulfNiwGmrxL8AlMvvsNqn8cz0xIYk2f13jsQ&code_challenge_method=S256"
Traceback (most recent call last):
  File "C:\Users\javad\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\\javad/.config/earthengine/credentials'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 21, in init
    ee.Initialize()
  File "C:\Users\javad\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\javad\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.12\apps\Python37\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "<string>", line 2, in <module>
  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/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\Map.py", line 15, in <module>
    ee_plugin.ee_auth.init()
  File "C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 23, in init
    if authenticate():
  File "C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 54, in authenticate
    'URL: ' + tiny_url(auth_url))
  File "C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 31, in tiny_url
    tinyurl = urllib.request.urlopen(apiurl + url).read()
  File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\urllib\request.py", line 641, in http_response
    'http', request, response, code, msg, hdrs)
  File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\urllib\request.py", line 503, in _call_chain
    result = func(*args)
  File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: Not Found

tried that, but nothing changed!

@XavierCLL
Copy link
Collaborator

could you please confirm this restarting Qgis and try again?

@M-Rezvanpour
Copy link
Author

I did that but same problem happened!

@XavierCLL
Copy link
Collaborator

Thanks, I'll review it, please keep tuned

@XavierCLL XavierCLL reopened this Aug 5, 2020
@XavierCLL
Copy link
Collaborator

XavierCLL commented Aug 5, 2020

@M-Rezvanpour yes now, could you please test with this zip (I couldn't reproduce it then I'm not sure if with this changes fix the problem): https://drive.google.com/file/d/1x8QCQ-5CzjQEk-cNEyMU87Xz5S8LaR7s/view?usp=sharing

@M-Rezvanpour
Copy link
Author

M-Rezvanpour commented Aug 6, 2020

@M-Rezvanpour yes now, could you please test with this zip (I couldn't reproduce it then I'm not sure if with this changes fix the problem): https://drive.google.com/file/d/1x8QCQ-5CzjQEk-cNEyMU87Xz5S8LaR7s/view?usp=sharing

Thanks, the dialog box now shows up!
but after that I got this error:

Traceback (most recent call last):
  File "C:\PROGRA~1\QGIS3~1.12\apps\Python37\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "<string>", line 2, in <module>
  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/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\Map.py", line 15, in <module>
    ee_plugin.ee_auth.init()
  File "C:/Users/javad/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_auth.py", line 21, in init
    ee.Initialize()
  File "C:\Users\javad\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\javad\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\javad\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\javad\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\javad\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\javad\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\discovery.py", line 264, in build
    raise e
  File "C:\Users\javad\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\javad\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\googleapiclient\discovery.py", line 308, in _retrieve_discovery_doc
    raise HttpError(resp, content, uri=actual_url)
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://earthengine.googleapis.com/$discovery/rest?version=v1alpha&prettyPrint=false returned "Forbidden">

@XavierCLL
Copy link
Collaborator

XavierCLL commented Aug 6, 2020

are you through a proxy? In your scripts, configure proxy settings on top of them:

import os
os.environ['HTTP_PROXY'] = 'http://[username:password@]<ip_address_or_domain>:<port>'
os.environ['HTTPS_PROXY'] = 'http://[username:password@]<ip_address_or_domain>:<port>'

import ee
from ee_plugin import Map

check the FAQ https://github.com/gee-community/qgis-earthengine-plugin#faq

@XavierCLL
Copy link
Collaborator

I'm going to close this, feel free to open it again if the bug persists

@zbss
Copy link

zbss commented Dec 29, 2020

Hi, I'm using QGIS version 3.14.16, this error occurred when I installed the Google Earth Engine plugin and tried to load the map.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants