Installation

Prerequisites

CausalEGM can be installed via Pip, Conda, and GitHub for Python users. CausalEGM can also be installed via CRAN and GitHub for R users.

pip prerequisites

  1. Install Python. we recommend Python>=3.9 and the venv or pyenv for creating a virtual environment and version management system.

  2. Take venv for instance. Create a virtual environment:

    python3 -m venv <venv_path>
    
  3. Activate the virtual environment:

    source <venv_path>/bin/activate
    

conda prerequisites

  1. Install conda through miniconda or anaconda.

  2. Create a new conda environment:

    conda create -n causalegm-env python=3.9
    
  3. Activate your environment:

    conda activate causalegm-env
    

GPU prerequisites (optional)

Training CausalEGM model will be faster when accelerated with a GPU (not a must). Before installing CausalEGM, the CUDA and cuDNN environment should be setup.

Install with pip

Install CausalEGM from PyPI using:

```
pip install CausalEGM
```

If you get a Permission denied error, use pip install CausalEGM --user instead. Pip will automatically install all the dependent packages, such as TensorFlow.

Alteratively, CausalEGM can also be installed through GitHub using::

```
pip install git+https://github.com/SUwonglab/CausalEGM.git
```

or:

``` 
git clone https://github.com/SUwonglab/CausalEGM && cd CausalEGM/src
pip install -e .
```

-e is short for --editable and links the package to the original cloned location such that pulled changes are also reflected in the environment.

Install with conda

  1. CausalEGM can also be downloaded through conda-forge. Add conda-forge as the highest priority channel:

    conda config --add channels conda-forge
    
  2. Activate strict channel priority:

    conda config --set channel_priority strict
    
  3. Install CausalEGM from conda-forge channel:

    conda install -c conda-forge causalegm
    

Install R package (RcausalEGM)

We provide a standard alone R package of CausalEGM via Reticulate, which is named RcausalEGM.

The easiest way to install CausalEGM for R is via CRAN:

```
install.packages("RcausalEGM")
```

Alternatively, users can also install RcausalEGM from GitHub source using devtools:

```
devtools::install_github("SUwonglab/CausalEGM", subdir = "r-package/RcausalEGM")
```

For Rstudio users, CausalEGM R packages can also be installed locally by directly opening the R project file RcausalEGM.Rproj.