ipywidgets is required for tqdm's notebook progress bar
See original GitHub issueIn a fresh environment I got this error (just the end a longer traceback) when downloading a product with dag.download(product)
from “scihub”. I post this issue here as I think this issue is mostly related to eodag.
~/.pyenv/versions/3.8.6/envs/complete-eodag/lib/python3.8/site-packages/eodag_sentinelsat/eodag_sentinelsat.py in extract(self, product_info)
192 for fileinfo in fileinfos:
193 zfile.extract(fileinfo, path=self.config.outputs_prefix)
--> 194 bar(1)
195 return product_info["path"][: product_info["path"].index(".zip")]
196 else:
~/.pyenv/versions/3.8.6/envs/complete-eodag/lib/python3.8/site-packages/eodag/utils/__init__.py in __call__(self, current_size, max_size)
392 self.max_size = max_size
393 if self.pb is None:
--> 394 self.pb = tqdm_notebook(
395 total=self.max_size,
396 unit=self.unit,
~/.pyenv/versions/3.8.6/envs/complete-eodag/lib/python3.8/site-packages/tqdm/notebook.py in __init__(self, *args, **kwargs)
237 unit_scale = 1 if self.unit_scale is True else self.unit_scale or 1
238 total = self.total * unit_scale if self.total else self.total
--> 239 self.container = self.status_printer(self.fp, total, self.desc, self.ncols)
240 self.container.pbar = self
241 self.displayed = False
~/.pyenv/versions/3.8.6/envs/complete-eodag/lib/python3.8/site-packages/tqdm/notebook.py in status_printer(_, total, desc, ncols)
110 # Prepare IPython progress bar
111 if IProgress is None: # #187 #451 #558 #872
--> 112 raise ImportError(
113 "IProgress not found. Please update jupyter and ipywidgets."
114 " See https://ipywidgets.readthedocs.io/en/stable"
ImportError: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
Two surprising things then:
-
tqdm
requiredipywidgets
for its notebook’s progress bar, however this dependency is set in their extras dependencies (notebook entry), which is unfortunate. I hadn’t noticed that before because I haveipywidgets
installed in my dev environment to run the tutorial, andNotebookWidgets
isn’t tested.https://github.com/tqdm/tqdm/blob/4591083884c8ca079ccd1192c079113c7baeadc8/setup.cfg#L85
-
When the product was being downloaded, the progress bar displayed was the default one. This error occurred when the product was being extracted. This is because
eodag-sentinelsat
calls directlyget_progress_callback
to display a progress bar while extracting a file. https://github.com/CS-SI/eodag-sentinelsat/blob/0969e0e69b97a9bad85ed4090027c0b873c8a196/eodag_sentinelsat/eodag_sentinelsat.py#L186
For 1., should we make ipywidgets
a dependency? Or in a new notebook
entry in the extras_require
?
If we make it an extra dependency, I’d have to check how to handle that with conda. I’m not sure they support extras_require
, however I think that I could change the recipe from script: {{ PYTHON }} -m pip install . -vv
to script: {{ PYTHON }} -m pip install .[notebook] -vv
. I’d have to make sure it works though.
For 2., I’ll directly comment in #237, and whatever we do, we’d certainly have to update eodag-sentinelsat, I’ll open an issue there too to keep track of that.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Usage of
tqdm.auto.tqdm
instead oftqdm.tqdm
andtqdm.notebook.tqdm
fixes the issue.tqdm.auto.tqdm
instead oftqdm.tqdm
eodag.utils.get_progress_callback
to make it return onlyProgressCallback
NotebookProgressCallback
fixed by GH-276