torchvision data downloader aborts if ipywidgets are not available
See original GitHub issueš Bug
I am testing some PyTorch code in Deepnote and the following call to torchvision aborts since the environment doesnāt support ipywidgets
test_data = torchvision.datasets.MNIST('../data', train=False, download=True, transform=local_transforms)
To Reproduce
Check the following notebook - https://deepnote.com/project/0b12c588-a1de-4d66-bb0f-fa6b8f9b1b87
ImportError: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-3-c62d245b04eb> in <module>
5 local_transforms = torchvision.transforms.Compose([local_transform_1, local_transform_2])
6
----> 7 test_data = torchvision.datasets.MNIST('../data', train=False, download=True, transform=local_transforms)
/shared-libs/python3.7/py/lib/python3.7/site-packages/torchvision/datasets/mnist.py in __init__(self, root, train, transform, target_transform, download)
77
78 if download:
---> 79 self.download()
80
81 if not self._check_exists():
/shared-libs/python3.7/py/lib/python3.7/site-packages/torchvision/datasets/mnist.py in download(self)
144 for url, md5 in self.resources:
145 filename = url.rpartition('/')[2]
--> 146 download_and_extract_archive(url, download_root=self.raw_folder, filename=filename, md5=md5)
147
148 # process and save as torch files
/shared-libs/python3.7/py/lib/python3.7/site-packages/torchvision/datasets/utils.py in download_and_extract_archive(url, download_root, extract_root, filename, md5, remove_finished)
254 filename = os.path.basename(url)
255
--> 256 download_url(url, download_root, filename, md5)
257
258 archive = os.path.join(download_root, filename)
/shared-libs/python3.7/py/lib/python3.7/site-packages/torchvision/datasets/utils.py in download_url(url, root, filename, md5)
70 urllib.request.urlretrieve(
71 url, fpath,
---> 72 reporthook=gen_bar_updater()
73 )
74 except (urllib.error.URLError, IOError) as e: # type: ignore[attr-defined]
/shared-libs/python3.7/py/lib/python3.7/site-packages/torchvision/datasets/utils.py in gen_bar_updater()
13
14 def gen_bar_updater() -> Callable[[int, int, int], None]:
---> 15 pbar = tqdm(total=None)
16
17 def bar_update(count, block_size, total_size):
/shared-libs/python3.7/py/lib/python3.7/site-packages/tqdm/notebook.py in __init__(self, *args, **kwargs)
246 unit_scale = 1 if self.unit_scale is True else self.unit_scale or 1
247 total = self.total * unit_scale if self.total else self.total
--> 248 self.container = self.status_printer(self.fp, total, self.desc, self.ncols)
249 self.container.pbar = self
250 if display_here:
/shared-libs/python3.7/py/lib/python3.7/site-packages/tqdm/notebook.py in status_printer(_, total, desc, ncols)
113 if IProgress is None: # #187 #451 #558 #872
114 raise ImportError(
--> 115 "IProgress not found. Please update jupyter and ipywidgets."
116 " See https://ipywidgets.readthedocs.io/en/stable"
117 "/user_install.html")
ImportError: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
Expected behavior
Maybe a check can be added that skips call to tqdm if itās not available?
cc @pmeier
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
How to get ipywidgets working in Jupyter Lab? - Stack Overflow
After digging into some of the libraries, I found the following: jupyter labextension install @jupyter-widgets/jupyterlab-manager is no longerĀ ...
Read more >Interactive data visualizations - Jupyter Book
Jupyter Notebook has support for many kinds of interactive outputs, including the ipywidgets ecosystem as well as many interactive visualization libraries.
Read more >How to use ipywidgets to make your Jupyter notebook ...
I'll show you the basics in this article of building a few simple forms to view and analyze some data. What are widgets?...
Read more >Interactive data analysis with dropdown menu Ipywidgets and ...
Interactive data analysis with dropdown menu Ipywidgets and Plotly in Jupyter Notebook. An example of how to set up an interactive dropdown menuĀ ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@vfdev-5 From my environment it seems tqdm version 4.55.1
Thanks. Iāve already tried the solution you linked. It doesnāt work. Let me see if I can figure out the patch.