question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ipywidgets is required for tqdm's notebook progress bar

See original GitHub issue

In 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:

  1. tqdm required ipywidgets 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 have ipywidgets installed in my dev environment to run the tutorial, and NotebookWidgets isn’t tested.

    https://github.com/tqdm/tqdm/blob/4591083884c8ca079ccd1192c079113c7baeadc8/setup.cfg#L85

  2. 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-sentinelsatcalls directly get_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:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
sbrunatocommented, May 25, 2021

Usage of tqdm.auto.tqdm instead of tqdm.tqdm and tqdm.notebook.tqdm fixes the issue.

class tqdm.auto.tqdm(tqdm.tqdm):
    """Automatically chooses beween `tqdm.notebook` and `tqdm.tqdm`."""
  • Use tqdm.auto.tqdm instead of tqdm.tqdm
  • Update eodag.utils.get_progress_callback to make it return only ProgressCallback
  • Deprecate NotebookProgressCallback
0reactions
sbrunatocommented, May 25, 2021

fixed by GH-276

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jupyter Notebooks not displaying progress bars - Stack Overflow
The answer is in this GitHub issue. The key is to ensure that you have the ipywidgets notebook extension enabled using the following...
Read more >
Progress Bar not showing up #11014 - GitHub
I have been using VS code for a while now and all of a sudden the progress bar stops appearing. I am using...
Read more >
Ever wanted Progress Bars in Jupyter? - Towards Data Science
The good news is you can create progress bars for Jupyter Notebooks with tqdm library. The library is incredibly easy to use and...
Read more >
How to Use Progress Bars in Python? | tqdm and tqdm Notebook
First, we need to install our required library tqdm. Open a New Jupyter Notebook and execute: !pip install tqdm !pip install time.
Read more >
tqdm.notebook - tqdm documentation
IPython /Jupyter Notebook progressbar decorator for iterators. Includes a default range iterator printing to stderr . Usage: >>> from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found