Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation updates to README and .github/workflows #637

Merged
merged 60 commits into from Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
a55f2c1
add gh action test-conda-forge-install
rolandrmgservices Jul 12, 2023
67842c7
add event trigger
rolandrmgservices Jul 12, 2023
58371fd
modify trigger
rolandrmgservices Jul 12, 2023
eb2769f
debug
rolandrmgservices Jul 12, 2023
be41da8
debug
rolandrmgservices Jul 12, 2023
99627cd
debug
rolandrmgservices Jul 12, 2023
92912f3
add test-conda-venv-install
rolandrmgservices Jul 12, 2023
8d0a144
add test-pypi-install
rolandrmgservices Jul 12, 2023
871aed1
fix name
rolandrmgservices Jul 12, 2023
cc6e9c2
fix name, typo
rolandrmgservices Jul 12, 2023
505b8cf
refactor test-conda-venv-install
rolandrmgservices Jul 12, 2023
b35c13d
refactor
rolandrmgservices Jul 12, 2023
cf137ed
rename .yaml to .yml
rolandrmgservices Jul 12, 2023
2570f0f
typo
rolandrmgservices Jul 12, 2023
88ee908
typo
rolandrmgservices Jul 12, 2023
a8db983
typo
rolandrmgservices Jul 12, 2023
fe43ec0
typo
rolandrmgservices Jul 12, 2023
101fe26
README.md add conda install hint
ras44 Jul 12, 2023
f86a7c0
move conda install hint in README
ras44 Jul 12, 2023
b3119f3
Remove $ prefix in README.md examples
ras44 Jul 12, 2023
f72f442
Mention gcc, g++ dependencies in README
ras44 Jul 12, 2023
e311484
typo
ras44 Jul 12, 2023
9a1bcee
add all python versions
rolandrmgservices Jul 12, 2023
5938182
add py[VERSION] identifier to job name
rolandrmgservices Jul 12, 2023
0f783d9
add tf-label combinations
rolandrmgservices Jul 12, 2023
52a27ee
remove tf
rolandrmgservices Jul 12, 2023
16577da
add tf
rolandrmgservices Jul 12, 2023
b725e32
Update test-conda-venv-install.yml
ras44 Jul 12, 2023
f1986b0
debugging py39
rolandrmgservices Jul 13, 2023
067eabf
Merge branch 'master' of github.com:ras44/causalml
rolandrmgservices Jul 13, 2023
605aa94
add back py37, py38
rolandrmgservices Jul 13, 2023
df4ffdc
numpy==1.23.2
rolandrmgservices Jul 13, 2023
511ebd1
Revert "numpy==1.23.2"
rolandrmgservices Jul 13, 2023
1379fa2
numpy>=1.18.5
rolandrmgservices Jul 13, 2023
5eee297
update env for tf-py38.yml
rolandrmgservices Jul 13, 2023
4673ff4
add pytest
rolandrmgservices Jul 13, 2023
b7fa9bf
pip -U pip, setuptools
rolandrmgservices Jul 13, 2023
0fad68f
archive before instance deletion
rolandrmgservices Jul 18, 2023
3ef3c53
rename
rolandrmgservices Jul 26, 2023
d46cf7e
Merge branch 'master' of github.com:uber/causalml
rolandrmgservices Jul 26, 2023
512cfb8
build matrix with tf
rolandrmgservices Jul 26, 2023
c6344b9
update paths
rolandrmgservices Jul 26, 2023
bb5747e
python setup.py build_ext --inplace
rolandrmgservices Jul 26, 2023
dc0af5e
create conda env, echo conda config
rolandrmgservices Jul 26, 2023
0c77146
echo conda config, export env, build inplace
rolandrmgservices Jul 26, 2023
03cb9b0
typo
rolandrmgservices Jul 26, 2023
13fdd99
echo env after build
rolandrmgservices Jul 26, 2023
095fce7
update env name format
rolandrmgservices Jul 26, 2023
aad154a
add conda compiler install
rolandrmgservices Jul 26, 2023
ff93b3d
move g++ install in README
rolandrmgservices Jul 26, 2023
9f61ce4
rename step
rolandrmgservices Jul 26, 2023
b9fc4e0
align py version naming style
rolandrmgservices Jul 26, 2023
80144a4
remove inplace build
rolandrmgservices Jul 26, 2023
a41fe39
Revert "numpy>=1.18.5"
rolandrmgservices Jul 26, 2023
6405b08
Revert "update env for tf-py38.yml"
rolandrmgservices Jul 26, 2023
0085a21
add py versions
rolandrmgservices Jul 26, 2023
8d607b2
rm channels spec
rolandrmgservices Jul 26, 2023
5241b60
add create conda env
rolandrmgservices Jul 26, 2023
540c395
add build_ext step
rolandrmgservices Aug 7, 2023
dc0ac40
typo
rolandrmgservices Aug 7, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/test-build-from-source.yml
@@ -0,0 +1,79 @@
name: Test build from source install

on:
push:
paths:
- 'envs/*.yml'
- '.github/workflows/test-build-from-source.yml'

jobs:
build:
name: ${{ matrix.os }}${{ matrix.tf-label }}-py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}

defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9]
tf-label: ['', '-tf']
include:
- python-version: 3.7
python-version-nd: 37
- python-version: 3.8
python-version-nd: 38
- python-version: 3.9
python-version-nd: 39
- tf-label: '-tf'
tf-label-pip: '[tf]'

steps:
- name: checkout repository
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: create environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: causalml${{ matrix.tf-label }}-py${{ matrix.python-version-nd }}
python-version: ${{ matrix.python-version }}
channels: defaults

- name: install cxx-compiler
run: |
conda install -c conda-forge cxx-compiler

- name: echo conda config
run: |
conda info
conda list
conda config --show-sources
conda config --show

- name: Build
run: |
pip install -U pip
pip install -U setuptools
python -m pip install .${{ matrix.tf-label-pip}}
python -m pip install .[test]
python setup.py build_ext --inplace

- name: Test with pytest
run: pytest -vs tests/ --cov causalml/

- name: echo conda env
run: |
conda env export


44 changes: 44 additions & 0 deletions .github/workflows/test-conda-forge-install.yml
@@ -0,0 +1,44 @@
name: Test conda-forge install

on:
push:
paths:
- 'envs/*.yml'
- '.github/workflows/test-conda-forge-install.yml'

jobs:
build:
name: ${{ matrix.os }}-py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9]
include:
- python-version: 3.7
python-version-nd: 37
- python-version: 3.8
python-version-nd: 38
- python-version: 3.9
python-version-nd: 39

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: create environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: causalml-py${{ matrix.python-version-nd }}
python-version: ${{ matrix.python-version }}

- name: Install from conda-forge
run: |
conda install -c conda-forge causalml
68 changes: 68 additions & 0 deletions .github/workflows/test-conda-venv-install.yml
@@ -0,0 +1,68 @@
name: Test conda-venv install

on:
push:
paths:
- 'envs/*.yml'
- '.github/workflows/test-conda-venv-install.yml'

jobs:
build:
name: ${{ matrix.os }}${{ matrix.tf-label }}-py${{ matrix.python-version-nd }}
runs-on: ${{ matrix.os }}

defaults:
run:
shell: bash -l {0}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9]
tf-label: ['', '-tf']
include:
- python-version: 3.7
python-version-nd: 37
- python-version: 3.8
python-version-nd: 38
- python-version: 3.9
python-version-nd: 39
- tf-label: '-tf'
tf-label-pip: '[tf]'

steps:
- name: checkout repository
uses: actions/checkout@v2

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: create environment
uses: conda-incubator/setup-miniconda@v2
with:
channels: defaults
auto-activate-base: false
activate-environment: causalml${{ matrix.tf-label }}-py${{ matrix.python-version-nd }}
environment-file: envs/environment${{ matrix.tf-label }}-py${{ matrix.python-version-nd }}.yml

- name: echo conda config
run: |
conda info
conda list
conda config --show-sources
conda config --show

- name: Build
run: |
pip install -U pip
pip install -U setuptools
python -m pip install .[test]
python setup.py build_ext --inplace

- name: Test with pytest
run: pytest -vs tests/ --cov causalml/

- name: echo conda env
run: |
conda env export
39 changes: 39 additions & 0 deletions .github/workflows/test-pypi-install.yml
@@ -0,0 +1,39 @@
name: Test PyPI install

on: [push]

jobs:
build:
name: ${{ matrix.os }}-py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: [3.7, 3.8, 3.9]
include:
- python-version: 3.7
python-version-nd: 37
- python-version: 3.8
python-version-nd: 38
- python-version: 3.9
python-version-nd: 39

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: create environment
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: causalml-py${{ matrix.python-version-nd }}
python-version: ${{ matrix.python-version }}

- name: Install using pip
run: |
pip install causalml
58 changes: 42 additions & 16 deletions README.md
Expand Up @@ -52,56 +52,82 @@ The package currently supports the following methods

# Installation

Installation with `conda` is recommended. `conda` environment files for Python 3.7, 3.8 and 3.9 are available in the repository. To use models under the `inference.tf` module (e.g. `DragonNet`), additional dependency of `tensorflow` is required. For detailed instructions, see below.
Installation with `conda` is recommended.

`conda` environment files for Python 3.7, 3.8 and 3.9 are available in the repository. To use models under the `inference.tf` module (e.g. `DragonNet`), additional dependency of `tensorflow` is required. For detailed instructions, see below.

## Install using `conda`:

Install `conda` with:

```
wget https://repo.anaconda.com/miniconda/Miniconda3-py38_23.5.0-3-Linux-x86_64.sh
bash Miniconda3-py38_23.5.0-3-Linux-x86_64.sh -b
source miniconda3/bin/activate
conda init
source ~/.bashrc
```

### Install from `conda-forge`
Directly install from the conda-forge channel using conda.

```sh
$ conda install -c conda-forge causalml
conda install -c conda-forge causalml
```

### Install with the `conda` virtual environment
This will create a new `conda` virtual environment named `causalml-[tf-]py3x`, where `x` is in `[6, 7, 8, 9]`. e.g. `causalml-py37` or `causalml-tf-py38`. If you want to change the name of the environment, update the relevant YAML file in `envs/`

```bash
$ git clone https://github.com/uber/causalml.git
$ cd causalml/envs/
$ conda env create -f environment-py38.yml # for the virtual environment with Python 3.8 and CausalML
$ conda activate causalml-py38
git clone https://github.com/uber/causalml.git
cd causalml/envs/
conda env create -f environment-py38.yml # for the virtual environment with Python 3.8 and CausalML
conda activate causalml-py38
(causalml-py38)
```

### Install `causalml` with `tensorflow`
```bash
$ git clone https://github.com/uber/causalml.git
$ cd causalml/envs/
$ conda env create -f environment-tf-py38.yml # for the virtual environment with Python 3.8 and CausalML
$ conda activate causalml-tf-py38
git clone https://github.com/uber/causalml.git
cd causalml/envs/
conda env create -f environment-tf-py38.yml # for the virtual environment with Python 3.8 and CausalML
conda activate causalml-tf-py38
(causalml-tf-py38) pip install -U numpy # this step is necessary to fix [#338](https://github.com/uber/causalml/issues/338)
```

## Install from `PyPI`:

```bash
$ pip install causalml
pip install causalml
```

### Install `causalml` with `tensorflow`
```bash
$ pip install causalml[tf]
$ pip install -U numpy # this step is necessary to fix [#338](https://github.com/uber/causalml/issues/338)
pip install causalml[tf]
pip install -U numpy # this step is necessary to fix [#338](https://github.com/uber/causalml/issues/338)
```

## Install from source:

### gcc, g++
`gcc` and `g++` must be installed on the system to compile C/C++ libraries.

For example, on ubuntu this can be done with:

```
sudo apt-get install -y gcc g++
```

Then:

```bash
$ git clone https://github.com/uber/causalml.git
$ cd causalml
$ pip install .
git clone https://github.com/uber/causalml.git
cd causalml
pip install .
```

with `tensorflow`:

```bash
pip install .[tf]
```
Expand Down