{"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":"en","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,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}