{"id":9232,"library":"pyprind","title":"PyPrind (Python Progress Indicator)","description":"PyPrind is a Python module that provides simple yet effective progress bar and percentage indicator utilities. It allows developers to visualize the progress of iterative computations, which is particularly useful for long-running processes or when handling large datasets. The library's current version is 2.11.3, with its last release in April 2021, indicating a slow release cadence and a current status of maintenance.","status":"maintenance","version":"2.11.3","language":"en","source_language":"en","source_url":"https://github.com/rasbt/pyprind","tags":["progress bar","cli","indicator","utility"],"install":[{"cmd":"pip install pyprind","lang":"bash","label":"Install PyPrind"}],"dependencies":[{"reason":"Optional dependency for monitoring CPU and memory usage when 'monitor=True' is set in ProgBar or ProgPercent.","package":"psutil","optional":true}],"imports":[{"symbol":"ProgBar","correct":"from pyprind import ProgBar"},{"symbol":"ProgPercent","correct":"from pyprind import ProgPercent"},{"note":"Generator function for progress bars, often used directly within loops.","symbol":"prog_bar","correct":"import pyprind\nfor i in pyprind.prog_bar(range(n)): pass"}],"quickstart":{"code":"import time\nimport pyprind\n\nn = 10000000 # Number of iterations\n\n# Using ProgBar class\nbar = pyprind.ProgBar(n, title='Processing Data')\nfor i in range(n):\n    # Simulate some computation\n    # time.sleep(0.000001) # Uncomment to slow down and see progress\n    bar.update()\nprint(bar)\n\nprint(\"\\nAlternatively, using the generator function:\")\n# Using prog_bar generator function\nfor i in pyprind.prog_bar(range(n), title='Another Task'):\n    # Simulate some computation\n    pass # time.sleep(0.000001)\n\n# Example with monitor=True (requires psutil)\n# try:\n#     bar_monitor = pyprind.ProgBar(100, monitor=True, title='Monitoring System')\n#     for i in range(100):\n#         time.sleep(0.1)\n#         bar_monitor.update()\n#     print(bar_monitor)\n# except ValueError as e:\n#     print(f\"Warning: {e}. Install psutil (pip install psutil) for monitoring.\")\n","lang":"python","description":"This example demonstrates how to create a progress bar using the `ProgBar` class and the `prog_bar` generator function. It initializes a progress bar with a specified number of iterations and updates it within a loop. An optional section shows how to use the `monitor=True` feature, which requires the `psutil` package."},"warnings":[{"fix":"Install the `psutil` package: `pip install psutil`.","message":"Enabling CPU/memory monitoring (`monitor=True`) requires the `psutil` package to be installed. Without it, a `ValueError` will be raised.","severity":"gotcha","affected_versions":"All versions when 'monitor=True' is used without `psutil`."},{"fix":"Upgrade to `pyprind` version 2.11.0 or newer to use the single-line progress bar display.","message":"Prior to version 2.11.0, the progress bar output would occupy two lines in the terminal. As of v2.11.0, it was consolidated to use only one line for a more compact display.","severity":"deprecated","affected_versions":"<2.11.0"},{"fix":"Update to `pyprind` version 2.11.2 or later to prevent extra new lines after the progress bar completes.","message":"In versions prior to 2.11.2, iterating over a completed `ProgBar` object could print unwanted new lines, causing display issues.","severity":"breaking","affected_versions":"<2.11.2"},{"fix":"Upgrade to `pyprind` version 2.10.0 or newer for improved Jupyter Notebook compatibility and display.","message":"Older versions (pre-2.10.0) had issues with Jupyter Notebooks where the ETA was printed on new lines, disrupting the output format.","severity":"gotcha","affected_versions":"<2.10.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install `psutil` using pip: `pip install psutil`.","cause":"Attempting to use `ProgBar(monitor=True)` or `ProgPercent(monitor=True)` without having the `psutil` library installed.","error":"ValueError: psutil package is required when using the `monitor` option."},{"fix":"Add `import pyprind` or `from pyprind import ProgBar` (or ProgPercent) at the top of your script.","cause":"The `pyprind` module or its classes/functions were used without being imported first.","error":"NameError: name 'pyprind' is not defined"},{"fix":"Ensure all code within a block (like a `for` loop) is indented consistently, typically with 4 spaces.","cause":"Python relies on consistent indentation. This error often occurs in loops where `bar.update()` or similar calls are not correctly indented within the loop body.","error":"IndentationError: expected an indented block"}]}