Registry / observability / progressbar2

progressbar2

JSON →
library4.6.0pypypi✓ verified 27d ago

progressbar2 is an actively maintained Python library designed to provide visual, text-based progress bars for long-running operations in CLI applications. It is a fork of the original `progressbar` package, aiming for backwards compatibility while offering enhanced features and ongoing development. The current stable version is 4.5.0.

pip install progressbar2
INSTALL
IMPORT
SIG · PROGRESSBAR2
P
progressbar2
observabilitypythonv4.6.0
Install
1.8s avg
Import
102ms
Disk
17MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.104s · 19.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.100s · 20MB
17MB installed
● package 17MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ProgressBar
from progressbar import ProgressBar
from progressbar2 import ProgressBar
Despite the package being named `progressbar2`, the primary module to import is `progressbar`.
widgets
from progressbar import Bar, Percentage, ETA
Commonly imported widgets include `Bar`, `Percentage`, `ETA`, `Timer`, `AdaptiveETA`, etc.
progressbar
import progressbar
The top-level `progressbar` module can be imported directly, often used when wrapping iterables like `progressbar.progressbar(range(100))`.

This example demonstrates basic usage with the context manager pattern. It initializes a progress bar with a maximum value and updates it in a loop. The bar automatically handles starting and finishing.

import time import progressbar MAX_VALUE = 100 with progressbar.ProgressBar(max_value=MAX_VALUE) as bar: for i in range(MAX_VALUE): # Simulate a task time.sleep(0.02) bar.update(i + 1) print("Task completed!")
Debug
Known issues
gotchaThe installed package is named `progressbar2`, but you must import `progressbar` in your Python code. Attempting to `import progressbar2` will result in an `ImportError`.
fix
Always use `import progressbar` or `from progressbar import ...`.
affects: All versions
gotchaIn Jupyter notebooks or environments that buffer `sys.stdout`, the progress bar output might appear mixed or delayed.
fix
To resolve this, explicitly flush stdout after updates or at critical points: `import sys; sys.stdout.flush()`.
affects: All versions
gotchaWhen using Jetbrains IDEs (like PyCharm), especially for advanced features like `MultiBar` support or to prevent interleaved output between the progress bar (which often writes to stderr) and `print` statements (writing to stdout), you may need to enable 'Enable terminal in output console' in your run configuration. Alternatively, redirect the progress bar to `sys.stdout`.
fix
In PyCharm, check 'Enable terminal in output console'. For code, consider `ProgressBar(fd=sys.stdout)` to unify output streams.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'progressbar'
This error occurs when the `progressbar2` library is installed, but the user attempts to import the original, unmaintained `progressbar` package, or when neither `progressbar` nor `progressbar2` is installed but the code tries to import `progressbar`.
fix
Ensure `progressbar2` is installed (`pip install progressbar2`) and import the `ProgressBar` class correctly using `from progressbar import ProgressBar` or `import progressbar` (then use `progressbar.ProgressBar`). The `progressbar` package on PyPI is different from `progressbar2`.
TypeError: __init__() got an unexpected keyword argument 'max_value'
This error typically arises when using an older version of the `progressbar` library or when `progressbar2` is installed but the code expects the `maxval` parameter (from the older API) instead of `max_value`. It can also happen if the old `progressbar` package is installed instead of `progressbar2`.
fix
Ensure `progressbar2` is installed and updated (`pip install --upgrade progressbar2`). Use `max_value` instead of `maxval` when initializing the `ProgressBar`. Example: `progressbar.ProgressBar(max_value=100)`.
TypeError: 'module' object is not callable
This error occurs when the user tries to call the `progressbar` module directly as a function (e.g., `progressbar()`) instead of instantiating the `ProgressBar` class within the module (e.g., `progressbar.ProgressBar()`). This often happens if both `progressbar` and `progressbar2` are confusingly present, or if the import statement is `import progressbar` and then the user mistakenly tries to call `progressbar()` instead of `progressbar.ProgressBar()`.
fix
Always instantiate the `ProgressBar` class from the `progressbar` module. If you imported with `import progressbar`, use `bar = progressbar.ProgressBar(...)`. If you used `from progressbar import ProgressBar`, then use `bar = ProgressBar(...)`.
AttributeError: module 'progressbar' has no attribute 'streams'
This error indicates that the installed `progressbar` package is the original, unmaintained version (or an incompatible version), which lacks the `streams` attribute present in `progressbar2`.
fix
Uninstall any older `progressbar` package (`pip uninstall progressbar`) and then install `progressbar2` (`pip install progressbar2`) to ensure you are using the actively maintained version that includes the `streams` functionality.
ValueError: Value X is out of range, should be between 0 and Y
This error occurs when the `update()` method of the progress bar is called with a value that is outside the defined `max_value` (or `maxval` in older versions) range.
fix
Ensure that the value passed to `progress.update()` is always within the valid range of `0` to `max_value` (inclusive). Double-check the loop or calculation that determines the update value to prevent it from exceeding `max_value`.
Upgrade
Version history
4.6.0latest on PyPI · released Aug 14, 2026
Audit
Dependencies
requestsoptionalOptional dependency for examples involving network requests (e.g., file downloads).
Agent activity
19 hits · last 30 days
node
14
OpenAI (training)
2
Amazon
1
Resources
progressbar2 — pip install progressbar2 · libregistry