Installation
causalig needs Python ≥ 3.10. Its only hard dependencies are PyTorch ≥ 2.0 and NumPy.
From a clone (recommended for now)
git clone https://github.com/sifrimlab/CausalIG.git
cd CausalIG
pip install -e .
Or install straight from GitHub without cloning:
pip install "causalig @ git+https://github.com/sifrimlab/CausalIG.git"
Tip
On Linux, pip install torch pulls the CUDA build by default, which is several GB. On a CPU-only machine,
install the CPU wheel before installing causalig:
pip install torch --index-url https://download.pytorch.org/whl/cpu
With conda
The repository ships an environment.yml that creates a causalig environment:
conda env create -f environment.yml
conda activate causalig
pip install -e ".[shap,experiments]" # adds the extras needed for the paper's experiments
Optional extras
Extra |
Installs |
Needed for |
|---|---|---|
|
|
The Shapley-value baselines |
|
|
Running |
|
|
Running the test suite and linters (see Development). |
pip install -e ".[shap]"
pip install -e ".[experiments]"
pip install -e ".[dev]"
import causalig never imports shap: the SHAP baselines are loaded lazily the first time you access
causalig.attr.CausalSHAP or causalig.attr.ConditionalSHAP.
Check the install
python -c "import causalig; print(causalig.__version__)"