Install & Compatibility
Where this runs
tested against v0.13.13 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.542s · 80.4MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.8s · import 1.406s · 81MB
72MB installed
● package 72MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
set_trace
✓ from ipdb import set_trace
✗ import ipdb; ipdb.set_trace()
post_mortem
✓ from ipdb import post_mortem
To use `ipdb.set_trace()`, simply place it where you want to pause execution. Run your script, and it will drop you into an interactive debugging session at that point. You can then inspect variables, step through code, and execute commands. Alternatively, run your script directly with `python -m ipdb your_script.py` to start debugging from the beginning or upon an exception.
import ipdb
def divide(a, b):
try:
# Set a breakpoint to inspect variables before the division
ipdb.set_trace()
result = a / b
return result
except ZeroDivisionError:
print("Cannot divide by zero!")
return None
print(divide(10, 2))
# To trigger the debugger on error, uncomment the line below and remove the try-except:
# divide(10, 0)
ipdb --version
Debug
Known issues
breakingCritical IPython dependency versioning: `ipdb` relies heavily on `IPython`. Ensure correct `IPython` versions are installed for your Python version to avoid conflicts or missing features. For Python 3.6, install `7.16.3 <= IPython < 7.17.0`. For Python > 3.6, install `IPython >= 7.31.1`. Consult `ipdb`'s `HISTORY.txt` for detailed historical requirements if using older Python versions.fixCheck `ipdb`'s `HISTORY.txt` or PyPI `Requires-Python` and `Requires-Dist` for exact `IPython` version constraints for your Python environment and `pip install 'ipython<X.Y'` or `'ipython>=X.Y'` accordingly.
affects: All versions, specific to Python interpreter version
gotchaDo not leave `ipdb.set_trace()` calls in production code. These breakpoints will halt program execution and expose the interactive debugger, which is a security risk and an operational blocker.fixRemove `ipdb.set_trace()` before deploying code to production. Consider using environment variables or conditional logic to enable debuggers only in development environments.
affects: All versions
gotchaIn Jupyter Notebooks on Windows, `ipdb` may occasionally fail to display the current line and context (e.g., with the 'l' command) due to inconsistent directory separator handling (mixed slashes).fixNo official fix yet; a reported workaround involves a minor change to `debugger.py` to canonicalize filenames. Consider using `pdb` or external IDE debuggers for complex Windows/Jupyter setups if this issue persists.
affects: 0.13.9 and possibly others (observed in February 2022)
deprecatedOlder `ipdb` versions dropped support for various Python versions. `ipdb` version 0.6 dropped Python 2.4 support, version 0.8 dropped Python 2.5 support, and version 0.10.3 dropped Python 3.2 support. Current versions require Python >= 2.7, excluding 3.0-3.3.fixUpgrade to the latest `ipdb` version compatible with your Python interpreter, or ensure your Python version meets `ipdb`'s `requires_python` specification.
affects: < 0.13.13
gotchaWhen using `ipdb` in environments that manipulate standard output (e.g., certain testing frameworks like older versions of `nose`), `ipdb`'s display might be affected. `ipdb` versions <= 0.9.4 had brittle strategies for handling such scenarios.fixUpdate `ipdb` to the latest version. If issues persist, consult the documentation of the conflicting tool or consider alternative debugging approaches for that specific environment.
affects: <= 0.9.4, but can affect newer versions with specific stdout-hooking tools
gotchaChanges made to variables or objects within an IPython interactive shell launched from `ipdb` (e.g., using magic functions like `%ipdb`) might not always propagate back or affect the `ipdb` shell's context, leading to unexpected behavior if you expect state changes to persist across shells.fixBe aware that the IPython sub-shell might have a separate scope for certain operations. For direct manipulation of variables in the `ipdb` context, use `ipdb`'s native commands (e.g., `!variable = new_value`) or `p`rint to confirm state.
affects: All versions
Upgrade
Version history
0.13.13latest on PyPI · released Mar 9, 2023
Audit
Dependencies
ipythonrequiredCore dependency for enhanced debugging features. Specific versions are required depending on your Python version.
decoratorrequiredRuntime dependency for functionality.
pathliboptionalRuntime dependency, typically for older Python versions that don't have it built-in.
tomlrequiredUsed for reading configuration files (e.g., pyproject.toml).
tomlirequiredUsed for reading TOML configuration files, especially for Python versions 3.6-3.10.