voxel51 / eta

ETA: Extensible Toolkit for Analytics
https://voxel51.com
Apache License 2.0
29 stars 13 forks source link

Progress bar regression in `v0.8.2` #579

Closed radao closed 1 year ago

radao commented 1 year ago

The new release seems to have broke the fo_dataset.add_samples method. This is with fiftyone==0.18.0:

dataset.add_samples(samples=fo_samples, expand_schema=True, dynamic=False, validate=True)
  File "/root/conda/envs/3.10/lib/python3.10/site-packages/fiftyone/core/dataset.py", line 2209, in add_samples
    for batch in batcher:
  File "/root/conda/envs/3.10/lib/python3.10/site-packages/fiftyone/core/utils.py", line 957, in __iter__
    self._pb.__enter__()
  File "/root/conda/envs/3.10/lib/python3.10/site-packages/eta/core/utils.py", line 1670, in __enter__
    self.start()
  File "/root/conda/envs/3.10/lib/python3.10/site-packages/eta/core/utils.py", line 1829, in start
    self._is_nested = self._cap_obj.__enter__()
  File "/root/conda/envs/3.10/lib/python3.10/site-packages/eta/core/utils.py", line 1391, in __enter__
    self.start()
  File "/root/conda/envs/3.10/lib/python3.10/site-packages/eta/core/utils.py", line 1435, in start
    logger.handlers[idx].stream = self._cache_stdout
AttributeError: can't set attribute 'stream'
brimoor commented 1 year ago

Hmm, strange I'm not able to reproduce on Python 3.9 or 3.10.

This is the change that was made: https://github.com/voxel51/eta/pull/574/files

The idea is to update the stream property of all logging.StreamHandler instances in your current logging setup so that the progress bar can be intertwined cleanly with any logging you might be doing within your loop.

Are you able to track down the type of whatever logger.handlers[idx] is? The code in _get_stdout_loggers() should only be grabbing StreamHandler objects...

I thought perhaps setting logging.StreamHandler.stream was disallowed in Python 3.10 or something, but that doesn't seem to be the case 🤔

In the meantime, you can bypass this error via:

import fiftyone as fo
import fiftyone.zoo as foz

fo.config.show_progress_bars = False

# Show should now work as the progress bar code won't run
dataset = foz.load_zoo_dataset("quickstart")