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

Authentication Window missing #92

Closed FelixTheAwesomeCat closed 3 years ago

FelixTheAwesomeCat commented 3 years ago

Hello, when I install the plugin, no authentication window appears. I tried it with 'earthengine authenticate' but then this error appears:

Traceback (most recent call last): File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\code.py", line 63, in runsource code = self.compile(source, filename, symbol) File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\codeop.py", line 168, in call return _maybe_compile(self.compiler, source, filename, symbol) File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\codeop.py", line 99, in _maybe_compile raise err1 File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\codeop.py", line 87, in _maybe_compile code1 = compiler(source + "\n", filename, symbol) File "C:\PROGRA~1\QGIS3~1.10\apps\Python37\lib\codeop.py", line 133, in call codeob = compile(source, filename, symbol, self.flags, 1) File "", line 1 earthengine authenticate ^ SyntaxError: invalid syntax

Other codes work like import ee or ee.Initialize(). I tried to install the plugin on a clean QGIS, on different QGIS versions (3.10.13 and 3.16.4) and on differnet PCs. Same problem. I cant get to the authentication window that should appear normally.

Thanks for your help!

gena commented 3 years ago

Strange, maybe some firewall issues. You need to run earthengine authenticate in the Windows CMD? Not in QGIS. Install python, then pip install earthengine-api, and then earthengine authenticate, as mentioned in FAQ.

@XavierCLL, do you have ide what could it be?

FelixTheAwesomeCat commented 3 years ago

I tried on another PC, also QGIS 3.16.4 same Problem! I did what u told me, it worked, however if I try this code in qgis console:

import ee print(ee.String('Hello World from EE!').getInfo())

i get this error:

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\Vera\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\computedobject.py", line 32, in call return type.call(cls, *args, **kwargs) File "C:\Users\Vera\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\ee_string.py", line 32, in init self.initialize() File "C:\Users\Vera\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\ee_string.py", line 53, in initialize apifunction.ApiFunction.importApi(cls, 'String', 'String') File "C:\Users\Vera\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\apifunction.py", line 183, in importApi cls.initialize() File "C:\Users\Vera\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\Vera\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\ee_plugin\extlibs_windows\ee\data.py", line 1042, in getAlgorithms call = _cloud_api_resource.projects().algorithms().list( AttributeError: 'NoneType' object has no attribute 'projects'

So it is not working, right?

gena commented 3 years ago

No, something is not initialized or not installed. You're trying with the latest version of QGIS EE plugin 0.0.3, right? Can you try to reinstall it in QGIS?

If you login to http://code.earthengine.google.com, everything works without any problem, right?

After running earthengine authenticate in the windows terminal, can you try to run the same code as above in a normal python (not in QGIS), does it work?

XavierCLL commented 3 years ago

Hi @gena and @FelixTheAwesomeCat that is exactly what I was discussing in #91 could you please test this package with the latest commits: https://drive.google.com/file/d/1x8QCQ-5CzjQEk-cNEyMU87Xz5S8LaR7s/view?usp=drivesdk

FelixTheAwesomeCat commented 3 years ago

I tried it with a clean qgis, latest stable (3.16.4) and a new pc. Same problem. Import ee doesn't work on my python. The Earthengine commands work.

gena commented 3 years ago

So, earthengine ls runs without problems? And also you can reach the EE Code Editor fine in a web browser?

If EE scripts do not work under Python - I'd first try to figure out why (this has nothing to do with the QGIS or QGIS EE, but more with your python environment and/or libraries, paths, firewall).

You can also check/ask on https://github.com/google/earthengine-api/issues.

FelixTheAwesomeCat commented 3 years ago

@XavierCLL your version worked fine!

FelixTheAwesomeCat commented 3 years ago

@gena earthengine ls does nothing but i dont get an error ether. I can reach the web editor just fine.

gena commented 3 years ago

@XavierCLL , hmm, I thought this was released with 0.0.3.

XavierCLL commented 3 years ago

91 was after v0.0.3

XavierCLL commented 3 years ago

Good idea release a minor release with these changes

gena commented 3 years ago

Yes, we should probably make a minor next release to have this fixed

FelixTheAwesomeCat commented 3 years ago

Thanks for the fast help!

XavierCLL commented 3 years ago

@FelixTheAwesomeCat thanks for reported and tested it, fixed with #91

gena commented 3 years ago

@XavierCLL, check PR #93, this adds a small backwards-compatibility fix as well (prevents crashing with older QGIS EE projects)