{"id":5673,"library":"objgraph","title":"objgraph","description":"objgraph is a Python module that lets you visually explore Python object graphs. It helps in debugging, understanding memory usage, and finding memory leaks by drawing object reference graphs using Graphviz. The library is actively maintained with regular updates for Python version compatibility.","status":"active","version":"3.6.2","language":"python","source_language":"en","source_url":"https://github.com/mgedmin/objgraph","tags":["debugging","memory","profiling","graphviz","visualization","object-graph"],"install":[{"cmd":"pip install objgraph","lang":"bash","label":"Basic installation"},{"cmd":"pip install objgraph[ipython]","lang":"bash","label":"Installation with Graphviz Python package for IPython/Jupyter"}],"dependencies":[{"reason":"Required for generating and rendering DOT graph files into images (e.g., PNG) or for interactive viewing with tools like xdot.","package":"graphviz (system utility)","optional":false},{"reason":"Optional Python binding for Graphviz, used for inline display in environments like IPython/Jupyter notebooks. Included with `objgraph[ipython]` installation.","package":"graphviz (Python package)","optional":true}],"imports":[{"note":"The primary module containing all functions.","symbol":"objgraph","correct":"import objgraph"}],"quickstart":{"code":"import objgraph\n\ndef create_objects():\n    x = []\n    y = [x, [x], {'x_key': x}]\n    z = {'list_ref': y, 'dict_ref': {'inner_x': x}}\n    return x, y, z\n\nx, y, z = create_objects()\n\n# Show references reachable from 'y', save to a PNG\nobjgraph.show_refs([y], filename='sample-graph.png', max_depth=2)\nprint(\"Generated sample-graph.png showing references from 'y'\")\n\n# Show backreferences to 'x', save to a PNG\nobjgraph.show_backrefs([x], filename='sample-backref-graph.png', max_depth=2)\nprint(\"Generated sample-backref-graph.png showing backreferences to 'x'\")\n\n# Show most common types in memory\nprint(\"\\nMost common types in memory:\")\nobjgraph.show_most_common_types(limit=5)","lang":"python","description":"This quickstart demonstrates how to create some interconnected Python objects and then use `objgraph.show_refs` to visualize objects reachable from a given object, `objgraph.show_backrefs` to see what objects reference a specific object, and `objgraph.show_most_common_types` to get a summary of memory usage. For graph visualization, ensure the Graphviz system utility is installed and accessible in your PATH."},"warnings":[{"fix":"Ensure your Python environment is 3.8 or newer for `objgraph>=3.6.0`. Check `objgraph`'s `requires_python` metadata on PyPI for the exact minimum version supported by your target `objgraph` version.","message":"objgraph version 3.6.0 and later dropped support for Python 2.x and Python 3.7. Previous versions (e.g., 3.5.0) dropped Python 3.5 support, and 3.4.1 dropped 3.3 and 3.4.","severity":"breaking","affected_versions":">=3.6.0 (for Python 2.x, 3.7); >=3.5.0 (for Python 3.5); >=3.4.1 (for Python 3.3, 3.4)"},{"fix":"Install Graphviz on your operating system (e.g., `sudo apt-get install graphviz` on Debian/Ubuntu, `brew install graphviz` on macOS, or download from graphviz.org). Optionally, install the Python `graphviz` package (`pip install graphviz` or `pip install objgraph[ipython]`) for better integration, especially in Jupyter.","message":"Drawing object graphs with `show_refs()` or `show_backrefs()` requires the external Graphviz system utility to be installed and available in your system's PATH. Without it, image generation will fail.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to objgraph 3.5.0 or later to ensure the `filename` argument behaves as expected, or omit `filename` to leverage the interactive viewer if `xdot` is installed.","message":"In IPython/Jupyter notebooks, before version 3.5.0, explicitly passing a `filename` argument to `show_refs()` or `show_backrefs()` might still trigger inline graph display instead of only saving to the specified file.","severity":"gotcha","affected_versions":"<3.5.0"},{"fix":"Install `xdot` (`pip install xdot` or via system package manager) and call `show_refs()` or `show_backrefs()` without a `filename` argument.","message":"For interactive viewing of graphs without saving to a file, `objgraph` can integrate with `xdot`. You'll need to install `xdot` separately (`pip install xdot` or system-wide) and omit the `filename` argument from `show_refs`/`show_backrefs`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"search_vec":"'activ':36 'compat':44 'debug':18,45 'draw':27 'explor':11 'find':23 'graph':14,30,52 'graphviz':32,48 'help':16 'leak':25 'let':8 'librari':34 'maintain':37 'memori':20,24,46 'modul':6 'object':13,28,51 'object-graph':50 'objgraph':1,2 'profil':47 'python':5,12,42 'refer':29 'regular':39 'understand':19 'updat':40 'usag':21 'use':31 'version':43 'visual':10,49","created_at":"2026-04-14T03:38:49.872817+00:00","updated_at":"2026-04-17T14:59:49.225585+00:00","problems":[{"fix":"Ensure objgraph is installed by running: `pip install objgraph` or `pip3 install objgraph`. If using a virtual environment, activate it first. If in an IDE, ensure the correct Python interpreter is selected.","cause":"The 'objgraph' package is not installed in the current Python environment or the Python interpreter being used by your IDE/terminal does not have access to it.","error":"ModuleNotFoundError: No module named 'objgraph'"},{"fix":"Install Graphviz on your operating system and ensure its executables (especially `dot`) are added to your system's PATH. For example, on Ubuntu: `sudo apt-get install graphviz`, on macOS with Homebrew: `brew install graphviz`, or download from graphviz.org for Windows.","cause":"objgraph relies on the external Graphviz software to render object graphs into image files (like PNGs) or display them interactively. This error indicates that the 'dot' executable (part of Graphviz) is not installed on your system or is not accessible in your system's PATH.","error":"Image renderer (dot) not found, not doing anything else."},{"fix":"Upgrade pip to its latest version: `python -m pip install --upgrade pip`. Also, verify that your Python version is compatible with objgraph (objgraph requires Python >= 3.7). If not, update your Python installation.","cause":"This error typically occurs when your Python version does not meet the requirements of the latest objgraph release, or your pip version is outdated, preventing it from finding compatible package versions.","error":"ERROR: Could not find a version that satisfies the requirement objgraph"},{"fix":"Install Graphviz on your operating system (e.g., `sudo apt-get install graphviz` on Debian/Ubuntu, `brew install graphviz` on macOS, or download from graphviz.org) and ensure its executables are added to your system's PATH environment variable.","cause":"objgraph relies on the external Graphviz command-line tools to render graphs, but the 'dot' executable is not found in your system's PATH.","error":"graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-V'], make sure the Graphviz executables are on your systems' PATH"},{"fix":"Install one of the Python Graphviz wrapper libraries: `pip install graphviz` (recommended) or `pip install pygraphviz`","cause":"objgraph requires a Python wrapper for Graphviz (either pygraphviz or graphviz) to be installed to interact with the Graphviz executables, but neither was found.","error":"ImportError: You need to install pygraphviz or graphviz for Graphviz support."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"3.6.2","cli_name":"objgraph","cli_version":"sh: 1: objgraph: not found","type":"library","homepage":"https://mg.pov.lt/objgraph/","github":"https://github.com/mgedmin/objgraph","docs":null,"changelog":null,"pypi":"https://pypi.org/project/objgraph/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["observability"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-30","next_check":"2026-07-28","install_tag":null}}