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

Push new version to support Python 3.10 #109

Closed
XavierCLL opened this issue Jun 4, 2022 · 27 comments
Closed

Push new version to support Python 3.10 #109

XavierCLL opened this issue Jun 4, 2022 · 27 comments
Assignees

Comments

@XavierCLL
Copy link
Collaborator

XavierCLL commented Jun 4, 2022

Push new minor version specially for this fix 38c25d5 to support operation systems and new versions of Qgis with Python >= 3.10. Issue related #105

@gena
Copy link
Collaborator

gena commented Jun 4, 2022

I will probably then drop support for Python 3.7 as well.

And should it be Python 3.10 or 3.9.5? It looks like the long-term release of QGIS 3.22.3-Białowieża is based on Python 3.9.5, it would be nice to have it working as well probably.

@XavierCLL
Copy link
Collaborator Author

XavierCLL commented Jun 4, 2022

The solution works with the latest versions of Python and the old ones (that I tested), I tested both Qgis versions one with Python 3.9 and the other with Python 3.10, and both work fine.

@gena
Copy link
Collaborator

gena commented Jun 4, 2022

Great!

Ok, I've repackaged and uploaded (as experimental) v0.0.5 with http2 changes and with the latest version of the EE lib.

Now it's time to test if this works in different OSes and QGIS versions. The minimum QGIS requirements are the same (3.8).

@gena
Copy link
Collaborator

gena commented Jun 5, 2022

@XavierCLL @SiggyF, can you check if https://plugins.qgis.org/plugins/ee_plugin/version/0.0.5/ works on Ubuntu and macOS?

Delete the previous version first and delete EE credentials (~/.config/earthengine/...).

@XavierCLL
Copy link
Collaborator Author

I've found and fixed two issues: 2c8d5d8 and 0f81f76

I've tested the package v0.0.5 with the previous patches, it works great on:

ArchLinux:

  • Qgis 3.24, python 3.10
  • Qgis 3.18, python 3.9

@gena
Copy link
Collaborator

gena commented Jun 6, 2022

Great!

Fixes look fine, I will repackage everything, re-upload v0.0.5, and will test on Windows. If everything works fine - will push this as the last release version, but won't warn people to upgrade v0.0.4 > v0.0.5 as this is a minor release as, everything should work fine for those who are authenticated.

@XavierCLL
Copy link
Collaborator Author

Hi @gena I've realized that the version that you uploaded 0.0.5 doesn't have the fixes I made in the previous comment, those are important for the proper functioning of the plugin (mainly for python 3.10), could you please upload a minor release like 0.0.5a with these fixes? thanks!

@XavierCLL
Copy link
Collaborator Author

I saw that the version 0.0.5 is an experimental version, a kind reminder to launch the official version 0.0.5 with these fixes when you can, thanks

@gena
Copy link
Collaborator

gena commented Jun 23, 2022

Correct, I did not push 0.0.5 as an official release, but probably it makes sense.

Though I'm not sure it is necessary to push existing users to upgrade as the 0.0.4 seems to work fine once authentication was done before.

@gena
Copy link
Collaborator

gena commented Jun 23, 2022

Ok, @XavierCLL, I've re-uploaded 0.0.5 without experimental and, hopefully, added all fixes - please check. If everything works fine - I will release and tag 0.0.5 on GitHub

@XavierCLL
Copy link
Collaborator Author

Perfect, thanks

@PedroVenancio
Copy link

Hi @gena

I'm getting this error after upgrade from 0.0.4 to 0.0.5

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

ImportError: cannot import name 'GoogleEarthEnginePlugin' from 'ee_plugin.ee_plugin' (C:\Users/Agif/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin\__init__.py) 
Traceback (most recent call last):
  File "C:\OSGeo4W/apps/qgis-ltr/./python\qgis\utils.py", line 423, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:\Users/Agif/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\__init__.py", line 65, in classFactory
    from .ee_plugin import GoogleEarthEnginePlugin
ImportError: cannot import name 'GoogleEarthEnginePlugin' from 'ee_plugin.ee_plugin' (C:\Users/Agif/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\ee_plugin\ee_plugin\__init__.py)

Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] 
QGIS version: 3.22.7-Białowieża Białowieża, 5a65627a 

Any hint? Thanks!

@gena
Copy link
Collaborator

gena commented Jun 24, 2022

Thanks for reporting, @PedroVenancio! Investigating ...

@gena
Copy link
Collaborator

gena commented Jun 24, 2022

@PedroVenancio, can you try uninstalling/reinstalling v0.0.5?

@PedroVenancio
Copy link

@gena I did it

imagem

and get back to 0.0.4.

No problem with this version.

@gena
Copy link
Collaborator

gena commented Jun 24, 2022

0.0.5 should work as well (has latest EE library), was just updated.

If 0.0.4 breaks - try switching to 0.0.5

@XavierCLL
Copy link
Collaborator Author

Hi @PedroVenancio,

That is weird, that line of the error wasn't changed between the versions 0.0.5 and 0.0.4. I tested the new version in Windows and works fine, please try updating to 0.0.5 and restart Qgis, I guess it is due to a problem with the differences of external libs because @gena has updated the external libs in this latest version and Qgis load it at startup.

@gena
Copy link
Collaborator

gena commented Jun 24, 2022

It looks like the new 0.0.5 is not approved on qgis yet

@gena
Copy link
Collaborator

gena commented Jun 24, 2022

@XavierCLL, it also looks like we did not test 0.0.5 well yet, getting error when .config/earthengine/authentication is removed:

image

@PedroVenancio
Copy link

Hi @XavierCLL and @gena

I was waiting to the plugin's approval, but I've downloaded it from https://plugins.qgis.org/plugins/ee_plugin/version/0.0.5/ and installed manually and it seems fixed! No error now! Had you changed something @gena ?

Thanks!

@giswqs
Copy link
Member

giswqs commented Jun 24, 2022

As as as I know, Earth Engine (v0.1.316) does not work with Python. 3.10. You can authenticate it, but it fails ee.Initialize(). I am not sure how you made it work with Python 3.10.

@tylere @jdbcode

conda create -n gee python
conda activate gee
conda install mamba -c conda-forge
mamba install geemap -c conda-forge
import ee
ee.Authenticate(auth_mode='notebook')
ee.Initialize()

image

@gena
Copy link
Collaborator

gena commented Jun 24, 2022

I'm testing it locally with QGIS-3.18/Python 3.7.0, and still see the Authentication error from earthengine_api-0.1.316-py3.7.egg-info, investigating further, the following code reproduces the error:

import ee
pkce = ee.oauth._nonce_table('code_verifier')
code_verifier = pkce['code_verifier']
auth_url = ee.oauth.get_authorization_url(pkce['code_challenge'], None)
print(auth_url)

image

@gena
Copy link
Collaborator

gena commented Jun 24, 2022

Switched v0.0.5 back to Experimental for now

@XavierCLL
Copy link
Collaborator Author

@gena @PedroVenancio yeah confirmed It worked 2 weeks ago, maybe Google change something for the oauth, it requires more investigation.

@giswqs for python 3.10 you can fix that running that code like this:

import ee
import httplib2
ee.Authenticate(auth_mode='notebook')
ee.Initialize(http_transport=httplib2.Http())

@giswqs
Copy link
Member

giswqs commented Jun 25, 2022

@XavierCLL Thanks for the workaround. It appears that this issue has existed for a few months now. It would be great if this issue can be fixed by Google directly. Not many people know this workaround.

@gena
Copy link
Collaborator

gena commented Jun 25, 2022

I'm currently trying to find a way to authenticate properly. The best would be to use ee.Authenticate(), but currently, it fails in QGIS because it requires gcloud CLI.

@gena
Copy link
Collaborator

gena commented Jul 2, 2022

I think this can be considered fixed, the new version is in QGIS plugins repo and approved

@gena gena closed this as completed Jul 2, 2022
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

4 participants