alive-progress

raw JSON →
3.3.0 verified Fri Apr 24 auth: no python

alive-progress is a versatile and highly customizable Python library for creating animated progress bars in the terminal. It provides visual feedback for long-running tasks with real-time throughput, Estimated Time of Arrival (ETA), and a variety of cool animations. Currently at version 3.3.0, the library maintains an active development and release cadence, offering robust features for CLI applications.

pip install alive-progress
error ModuleNotFoundError: No module named 'alive_progress'
cause The 'alive-progress' package is not installed in the Python environment.
fix
Install the package using pip: 'pip install alive-progress'.
error ImportError: cannot import name 'alive_bar' from 'alive_progress'
cause The 'alive-progress' package is not installed or the import statement is incorrect.
fix
Ensure the package is installed and use the correct import statement: 'from alive_progress import alive_bar'.
error AttributeError: 'FloatProgress' object has no attribute 'style'
cause The 'alive-progress' bar is not displaying correctly in Jupyter Notebook due to compatibility issues.
fix
Enable notebook mode by adding 'from alive_progress.notebook import set_notebook' and 'set_notebook()' before using 'alive_bar'.
error alive_progress bar not working on PyCharm
cause The progress bar does not display correctly in PyCharm's console due to its default settings.
fix
Force TTY mode by setting 'force_tty=True' in 'alive_bar': 'with alive_bar(100, force_tty=True) as bar:'.
error TypeError: unhashable type: 'types.SimpleNamespace'
cause Older versions of 'alive-progress' (prior to v3.0) had issues with its print/logging hooks when multiple instances or complex threading/multiprocessing environments tried to concurrently manage terminal output.
fix
Upgrade alive-progress to version 3.0 or newer: pip install --upgrade alive-progress
gotcha When running in non-interactive environments like PyCharm consoles, Jupyter notebooks, or shell pipelines, alive-progress might automatically detect a non-TTY environment and only print the final receipt. To force the progress bar display, use the `force_tty=True` argument.
fix Use `with alive_bar(total, force_tty=True) as bar:` to explicitly enable the display in such environments.
breaking The method for setting inline messages within the progress bar changed in earlier major versions. Older versions used `bar('message')` to set text while incrementing. Current versions (3.x) use `bar(text='message')` for this purpose. Calling `bar('message')` without the `text=` keyword in 3.x will likely result in an error or unexpected behavior as it would try to interpret 'message' as an increment count.
fix Always use the `text='your message'` keyword argument when setting an inline message: `bar(text='current status')`. The `bar()` call without arguments increments the bar.
gotcha When `alive_bar` is initialized with a `total`, calling `bar()` without arguments increments an internal counter. To manually set the progress by a percentage (e.g., 15%), you must pass the fractional value to `bar()`: `bar(0.15)`. Mixing these approaches or passing a raw count when percentage is expected (or vice-versa) without understanding the mode can lead to incorrect progress display.
fix If `total` is provided, `bar()` increments. To set a specific percentage, call `bar(fractional_value)` (e.g., `bar(i / total)`). If no `total` is given, it operates in 'unknown' mode with no ETA, and `bar()` simply updates the spinner.
deprecated Support for older Python versions has been dropped. The library officially supports Python >=3.9.
fix Ensure your project uses Python 3.9 or newer.
runtime status import time mem disk
3.10-alpine 0.04s 1.5MB 18.6M
3.10-slim 0.02s 1.5MB 19M
3.11-alpine 0.08s 1.8MB 20.5M
3.11-slim 0.05s 1.8MB 21M
3.12-alpine 0.07s 1.5MB 12.4M
3.12-slim 0.05s 1.5MB 13M
3.13-alpine 0.05s 1.8MB 12.0M
3.13-slim 0.05s 1.6MB 12M
3.9-alpine 0.05s 1.5MB 18.1M
3.9-slim 0.02s 1.5MB 19M

This quickstart demonstrates the most common usage pattern for `alive-progress` using the `alive_bar` context manager. It initializes a progress bar with a total count and updates it in each iteration of a loop.

import time
from alive_progress import alive_bar

TOTAL_ITEMS = 100

with alive_bar(TOTAL_ITEMS, title='Processing items') as bar:
    for i in range(TOTAL_ITEMS):
        # Simulate a task
        time.sleep(0.05)
        bar() # Update the progress bar

print("Task completed!")