openforis / sepal_ui

wrapper for ipyvuetify widgets to unify the display of voila dashboards in the SEPAL plateform
https://map-app.up.railway.app
MIT License
13 stars 4 forks source link

Impossible to use GEE in RDT #275

Open 12rambau opened 3 years ago

12rambau commented 3 years ago

When I build the documentation locally there are no problems. When I build it with RDT i get the following errors coming from jupyter-sphinx:

[0;31m--------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) /tmp/ipykernel_244/3861035409.py in 1 from sepal_ui import mapping as sm 2 ----> 3 sm.SepalMap() ~/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.7/site-packages/sepal_ui/mapping/mapping.py in init(self, basemaps, dc, vinspector, gee, kwargs) 65 # init ee 66 self.ee = gee ---> 67 if gee: su.init_ee() 68 69 # init the rasters ~/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.7/site-packages/sepal_ui/scripts/utils.py in init_ee() 142 # decrypt the key 143 json_encrypted = Path(file).parent/'encrypted_key.json' --> 144 with json_encrypted.open('rb') as f: 145 json_decripted = fernet.decrypt(f.read()).decode() 146 ~/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py in open(self, mode, buffering, encoding, errors, newline) 1206 self._raise_closed() 1207 return io.open(self, mode, buffering, encoding, errors, newline, -> 1208 opener=self._opener) 1209 1210 def read_bytes(self): ~/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py in _opener(self, name, flags, mode) 1061 def _opener(self, name, flags, mode=0o666): 1062 # A stub for the opener argument to built-in open() -> 1063 return self._accessor.open(self, flags, mode) 1064 1065 def _raw_open(self, flags, mode=0o777): FileNotFoundError: [Errno 2] No such file or directory: '/home/docs/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.7/site-packages/sepal_ui/scripts/encrypted_key.json' Extension error: Cell raised uncaught exception: --------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) /tmp/ipykernel_244/3861035409.py in 1 from sepal_ui import mapping as sm 2 ----> 3 sm.SepalMap() ~/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.7/site-packages/sepal_ui/mapping/mapping.py in init(self, basemaps, dc, vinspector, gee, kwargs) 65 # init ee 66 self.ee = gee ---> 67 if gee: su.init_ee() 68 69 # init the rasters ~/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.7/site-packages/sepal_ui/scripts/utils.py in init_ee() 142 # decrypt the key 143 json_encrypted = Path(file).parent/'encrypted_key.json' --> 144 with json_encrypted.open('rb') as f: 145 json_decripted = fernet.decrypt(f.read()).decode() 146 ~/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py in open(self, mode, buffering, encoding, errors, newline) 1206 self._raise_closed() 1207 return io.open(self, mode, buffering, encoding, errors, newline, -> 1208 opener=self._opener) 1209 1210 def read_bytes(self): ~/.pyenv/versions/3.7.9/lib/python3.7/pathlib.py in _opener(self, name, flags, mode) 1061 def _opener(self, name, flags, mode=0o666): 1062 # A stub for the opener argument to built-in open() -> 1063 return self._accessor.open(self, flags, mode) 1064 1065 def _raw_open(self, flags, mode=0o777): FileNotFoundError: [Errno 2] No such file or directory: '/home/docs/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.7/site-packages/sepal_ui/scripts/encrypted_key.json'

(https://readthedocs.org/projects/sepal-ui/builds/14700568/).

It seems like the builder doesn't catch the .json file. even though it has been added to the package data in setup.py in 3c7cca2cecc178e2a3c25e7ee6467180fb4b97c6.

I think I will prevent the use of gee in the doc everywhere I can until I found a solution.

12rambau commented 3 years ago

It's the same as in the test. Everything that is calling EarthEngine uses the credential of the comunity account. so it has no asset folder. The folder needs to be manually set for every single tools: i.e. AoiTile, AoiView, ReclassifyTile... etc