wolph / python-progressbar

Progressbar 2 - A progress bar for Python 2 and Python 3 - "pip install progressbar2"
http://progressbar-2.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
860 stars 102 forks source link

outdatated progress bar? #276

Closed brando90 closed 1 year ago

brando90 commented 1 year ago

Description

Error when importing progressbar2.

Code

import progressbar
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<input>", line 1, in <module>
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/brandomiranda/opt/anaconda3/envs/explaining-emergence-icl-in-fms-with-diversity/lib/python3.10/site-packages/progressbar/__init__.py", line 4, in <module>
    from .shortcuts import progressbar
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/brandomiranda/opt/anaconda3/envs/explaining-emergence-icl-in-fms-with-diversity/lib/python3.10/site-packages/progressbar/shortcuts.py", line 1, in <module>
    from . import bar
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "/Users/brandomiranda/opt/anaconda3/envs/explaining-emergence-icl-in-fms-with-diversity/lib/python3.10/site-packages/progressbar/bar.py", line 50, in <module>
    class ProgressBarBase(collections.Iterable, ProgressBarMixinBase):
AttributeError: module 'collections' has no attribute 'Iterable'

Versions

ref: https://stackoverflow.com/questions/75355808/attributeerror-module-collections-has-no-attribute-iterable-for-progressbar

wolph commented 1 year ago

It's hard to say what has caused this, but the collections.Iterable on line 50 hasn't been a thing for several years: https://github.com/wolph/python-progressbar/commit/9af4d70e5e73fc1aa78f23bc808126ebe361580d

Oddly enough, that version already included the __version__ so I'm not sure what's happened there. I've got a feeling that you might have a mix between this package and the original progressbar package which is replaced by this one.

In any case, updating to the latest version (or uninstalling and reinstalling) should fix your issues