Install & Compatibility
Where this runs
tested against v0.14 · 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.930 runs
build_error
glibcpy 3.10–3.930 runs
installs and imports cleanly · install 33.1s · import 8.593s · 813MB
892MB installed
● package 892MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CausalModel
✓ from dowhy import CausalModel
gcm
✓ from dowhy import gcm
Introduced in v0.8 for Graphical Causal Models (GCMs) functionalities.
This quickstart demonstrates the core DoWhy workflow: defining a causal graph, identifying the effect using an estimand, estimating the effect with a specified method (e.g., linear regression), and finally refuting the estimate to check its robustness. It uses synthetic data to illustrate a simple causal model.
import dowhy
from dowhy import CausalModel
import pandas as pd
import numpy as np
# 1. Generate some sample data
np.random.seed(1)
n_samples = 100
treatment = np.random.randint(0, 2, n_samples)
confounder = np.random.normal(0, 1, n_samples)
outcome = 2 * treatment + 3 * confounder + np.random.normal(0, 1, n_samples)
data = pd.DataFrame({'treatment': treatment, 'confounder': confounder, 'outcome': outcome})
# 2. Model the causal problem
# Using a simple string-based GML representation of the graph
model=CausalModel(data=data,
graph="digraph { confounder -> treatment; confounder -> outcome; treatment -> outcome;}",
treatment=['treatment'],
outcome=['outcome'])
# 3. Identify a causal effect
identified_estimand = model.identify_effect(estimand_type="nonparametric-ate")
# 4. Estimate the causal effect using a statistical method
causal_estimate = model.estimate_effect(identified_estimand,
method_name="backdoor.linear_regression",
control_value=0,
treatment_value=1)
print(f"Causal Estimate: {causal_estimate.value}")
# 5. Refute the obtained estimate
# Using a refutation method to check robustness
refutation = model.refute_estimate(identified_estimand, causal_estimate,
method_name="random_common_cause")
print(f"Refutation (random common cause): {refutation.refutation_result}")
dowhy --version
Debug
Known issues
gotchaDefining an accurate causal graph is critical. Incorrectly specified graphs, especially neglecting unobserved confounders or including colliders, will lead to invalid causal effect estimates, which is the biggest footgun in causal inference.fixCarefully consider domain knowledge and potential confounding variables. Use tools like `DoWhy`'s `gcm` module or external causal discovery libraries to assist, but always validate assumptions with domain experts. DoWhy helps make assumptions explicit, but it cannot fix incorrect input.
affects: All versions
breakingDoWhy currently supports Python versions up to 3.13. Attempting to install or run DoWhy on Python 3.14 (when released) will likely encounter dependency conflicts or `ImportError` due to package compatibility constraints.fixEnsure your Python environment is between 3.9 and 3.13. Check DoWhy's official documentation for updated compatibility once Python 3.14 is officially released and supported.
affects: >=0.14 (for future Python 3.14+)
gotchaWhile `pip install dowhy` installs core functionality, advanced features like plotting causal graphs or using certain estimators (e.g., from `econml`) require extra dependencies that are not installed by default.fixFor plotting, install `graphviz` executables on your system and `pydot` via pip. For specific estimators or full functionality, consult the DoWhy documentation and install the required packages (e.g., `pip install dowhy[all]` or `pip install dowhy[econml]`).
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'graphviz' OR pydot.InvocationException: Program terminated with status: 1. stderr: 'dot: command not found'
Graphviz executable or the `pydot` Python package is missing. DoWhy relies on Graphviz for visualizing causal graphs.
fixInstall the `pydot` Python package (`pip install pydot`) and ensure the Graphviz executables are installed and available in your system's PATH. On Linux, run `sudo apt-get install graphviz`; on macOS, `brew install graphviz`; on Windows, install from `graphviz.org`.
KeyError: '[column_name]' OR ValueError: Column [column_name] not found in the data.
Mismatch between column names specified in `treatment`, `outcome`, or the causal graph string and the actual column names in the input DataFrame.
fixDouble-check all column names in your `data` DataFrame and ensure they exactly match the strings used in `CausalModel` initialization and the causal graph string.
ValueError: Method `[method_name]` is not a valid estimation method. Check `DoWhy.list_supported_methods()`
The specified estimation method name for `estimate_effect` is incorrect or not supported for the identified estimand type or current DoWhy version.
fixVerify the exact spelling of the method name. Use `model.list_supported_methods()` after identifying the estimand to see the available options that are compatible with your specific problem and estimand type.
Upgrade
Version history
0.14latest on PyPI · released Nov 8, 2025
Audit
Dependencies
graphvizoptionalRequired for visualizing causal graphs when calling 'model.plot_causal_graph()'
pydotoptionalPython interface for Graphviz, needed for graph visualization.
scikit-learnoptionalUsed by many built-in causal estimators for regression and classification tasks.
statsmodelsoptionalProvides statistical models and tests used by several estimators and refuters.
econmloptionalProvides advanced causal inference estimators, integrated with DoWhy.