{"id":6416,"library":"progressbar","title":"progressbar","description":"The `progressbar` library (version 2.5) provides text-based progress bars for long-running operations in Python. This version is largely unmaintained and is compatible only with Python 2. For modern Python projects, the actively maintained `progressbar2` library is recommended, which offers backward compatibility and Python 3 support.","status":"abandoned","version":"2.5","language":"python","source_language":"en","source_url":"https://github.com/progressbar-modules/progressbar2","tags":["progress bar","cli","console","abandoned","python2","legacy"],"install":[{"cmd":"pip install progressbar","lang":"bash","label":"For original progressbar (Python 2 only)"},{"cmd":"pip install progressbar2","lang":"bash","label":"Recommended for Python 3 (maintained fork)"}],"dependencies":[],"imports":[{"note":"While `from progressbar import ProgressBar` might work in some contexts, the idiomatic usage often involves importing the module directly and accessing classes/functions through it, especially for widgets. For `progressbar2`, the context manager is a common pattern.","wrong":"from progressbar import ProgressBar","symbol":"ProgressBar","correct":"import progressbar; pbar = progressbar.ProgressBar()"}],"quickstart":{"code":"import time\nimport progressbar\n\ndef main():\n    print(\"Using progressbar (v2.5) for demonstration (Python 2 example if run directly)\")\n    print(\"**It is HIGHLY recommended to use 'progressbar2' instead: pip install progressbar2**\\n\")\n\n    # This quickstart pattern is derived from progressbar2 examples,\n    # which aims for backward compatibility with the original 'progressbar'.\n    widgets = [\n        'Test: ', progressbar.Percentage(),\n        ' ', progressbar.Bar(marker=progressbar.RotatingMarker()),\n        ' ', progressbar.ETA(),\n        ' ', progressbar.FileTransferSpeed(),\n    ]\n\n    # For Python 2, range(100) is fine. For Python 3, use list(range(100)) or ensure xrange behavior.\n    # As this library is Python 2, simple range is shown.\n    bar = progressbar.ProgressBar(widgets=widgets, maxval=100).start()\n    for i in range(100):\n        # Simulate some work\n        time.sleep(0.01)\n        bar.update(i + 1)\n    bar.finish()\n\n    print(\"\\nExample complete.\")\n\nif __name__ == '__main__':\n    main()","lang":"python","description":"This quickstart demonstrates a basic progress bar with several common widgets. While `progressbar` (v2.5) is Python 2 only, this code is illustrative of the general API. For Python 3, it is critical to use `progressbar2` (pip install progressbar2) as a replacement. The `ProgressBar` class manages the progress, and various `widgets` define the display format."},"warnings":[{"fix":"Migrate to `progressbar2` (pip install progressbar2), which is Python 3 compatible and actively maintained.","message":"The `progressbar` (version 2.5) library is Python 2 only. It will not run on Python 3 environments without significant modifications or, more practically, replacement. Python 2 reached its end-of-life in 2020.","severity":"breaking","affected_versions":"All versions of `progressbar` (specifically 2.5 and earlier)"},{"fix":"Always use `progressbar2` for new projects or when updating existing projects. Install via `pip install progressbar2`.","message":"The original `progressbar` library is abandoned and unmaintained. Its development ceased, leading to the creation of `progressbar2` as a direct, backward-compatible fork.","severity":"deprecated","affected_versions":"All versions of `progressbar` (specifically 2.5 and earlier)"},{"fix":"To get the modern, maintained version, use `pip install progressbar2`. The import statement remains `import progressbar` for `progressbar2` due to backward compatibility.","message":"Installing `progressbar` via `pip install progressbar` will install the old, abandoned Python 2-only version (2.5). Users intending to use an actively maintained progress bar library for Python 3 should explicitly install `progressbar2`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure the output stream (typically `sys.stderr`) is flushed, or consider running long tasks in a separate thread if using GUI toolkits like Tkinter. The `progressbar2` library also offers `with progressbar.ProgressBar(...) as bar:` for better handling.","message":"Progress bars might not update visually during runtime in certain environments (e.g., some IDEs, Jupyter notebooks, or when long-running tasks block the event loop in GUI applications). This can lead to the bar appearing only at the end or updating erratically.","severity":"gotcha","affected_versions":"All versions of `progressbar` and `progressbar2`"}],"env_vars":null,"search_vec":"'2':31 '2.5':6 '3':49 'abandon':55 'activ':37 'backward':45 'bar':12,52 'base':10 'cli':53 'compat':27,46 'consol':54 'larg':23 'legaci':57 'librari':4,40 'long':15 'long-run':14 'maintain':38 'modern':33 'offer':44 'oper':17 'progress':11,51 'progressbar':1,3 'progressbar2':39 'project':35 'provid':7 'python':19,30,34,48 'python2':56 'recommend':42 'run':16 'support':50 'text':9 'text-bas':8 'unmaintain':24 'version':5,21","created_at":"2026-04-15T05:36:21.890635+00:00","updated_at":"2026-04-16T18:11:11.405974+00:00","problems":[{"fix":"Ensure you are using Python 2 and have installed the specific version:\n`pip install progressbar==2.5`\nFor Python 3, it is highly recommended to use `progressbar2`:\n`pip install progressbar2`","cause":"This error occurs when the `progressbar` library is not installed, or the Python environment where it's being run cannot find the installed package. This is particularly common if `progressbar2` was installed instead, or if using a virtual environment incorrectly.","error":"ImportError: No module named progressbar"},{"fix":"If using Python 3 or requiring modern features like `streams`, upgrade to or install `progressbar2`:\n`pip install progressbar2`\nIf you must use `progressbar` 2.5 (Python 2 only), modify your code to remove references to `progressbar.streams`.","cause":"This error typically arises when code written for the `progressbar2` library, which introduced the `streams` module for output redirection, is executed with the older `progressbar` (version 2.5), which lacks this attribute.","error":"AttributeError: module 'progressbar' has no attribute 'streams'"},{"fix":"For `progressbar` 2.5, you must explicitly call `start()`, `update()`, and `finish()`:\n```python\nimport progressbar\nimport time\n\nbar = progressbar.ProgressBar(maxval=100, widgets=[progressbar.Bar(), progressbar.Percentage()])\nbar.start()\nfor i in range(100):\n    bar.update(i + 1)\n    time.sleep(0.01)\nbar.finish()\n```\nAlternatively, consider using `progressbar2` for a more `tqdm`-like iterable wrapping API.","cause":"This error occurs when a `ProgressBar` object from version 2.5 is treated as a callable function (e.g., `for i in progress(range(80))`), a pattern more common with iterable wrappers in `tqdm` or `progressbar2`, but not directly supported by `progressbar` 2.5's `ProgressBar` class for iteration.","error":"TypeError: 'ProgressBar' object is not callable"},{"fix":"Always initialize the progress bar with `start()` before beginning to update its progress:\n```python\nimport progressbar\nimport time\n\nbar = progressbar.ProgressBar(maxval=100)\nbar.start() # Call start() here\nfor i in range(100):\n    bar.update(i + 1)\n    time.sleep(0.01)\nbar.finish()\n```","cause":"This error indicates that the `update()` method of a `progressbar` object (version 2.5) was called before its `start()` method was invoked, which is a required step in the progress bar's lifecycle.","error":"RuntimeError: You must call \"start\" before calling \"update\""},{"fix":"Instead of `bar += increment`, use the `update()` method to modify the progress bar's value:\n```python\nimport progressbar\nimport time\n\nbar = progressbar.ProgressBar(maxval=100)\nbar.start()\nfor i in range(10):\n    # Do some work\n    time.sleep(0.1)\n    bar.update(bar.currval + 10) # Manually update the current value\nbar.finish()\n```\nFor the `+=` operator, migrate to `progressbar2`.","cause":"This error happens when attempting to update a `progressbar` 2.5 instance using the `+=` operator, a syntactic sugar introduced in `progressbar2` for incrementing the progress. The older `progressbar` library does not support this shorthand.","error":"TypeError: unsupported operand type(s) for +=: 'ProgressBar' and 'int'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.5","cli_name":"","cli_version":null,"type":"library","homepage":"http://code.google.com/p/python-progressbar","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/progressbar/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}