Installation¶
Install the progressbar2 package, then import it as progressbar.
You need Python 3.10 or later.
1. Install the package¶
Choose the command that matches how you manage your Python environment:
2. Check the import¶
Print the installed version from the same Python environment:
$ python -c "import progressbar; print(progressbar.__version__)"
In a uv project, run the check through uv:
$ uv run python -c "import progressbar; print(progressbar.__version__)"
A version number confirms that Python can import the installed package.
3. Run your first bar¶
Wrap a loop to track its progress:
"""Wrap an iterable to show its progress."""
import time
import progressbar
def main() -> None:
for _ in progressbar.progressbar(range(100), fast=False):
time.sleep(0.01)
if __name__ == '__main__':
main()
The loop processes 100 steps. progressbar.progressbar() starts the bar,
advances it as the loop runs and finishes it when the loop ends. The short
sleep makes the movement visible. Replace it with your own work.
Optional native iterator¶
The standard installation includes the update gate and automatic fast
renderer. The optional fast extra adds a native iterator for counting
items in large loops:
$ python -m pip install 'progressbar2[fast]'
For a uv project:
$ uv add 'progressbar2[fast]'
The examples work without this extra. The fast-path explanation describes when the native iterator is used.
Keep building¶
Start with the loop above, then control updates, set a total, choose widgets and print messages above the display.
Track file transfers, show several jobs together or add live values and colour to your progress display.