Skip to content

Commit b981361

Browse files
authored
Fix build errors (#832)
* up the version to 0.15.5dev * remove python setup.py build_ext --inplace from the github action and install instruction * update python versions to test in github action files * add [optional] to the graphviz installation step in the installation doc
1 parent c0eb84c commit b981361

7 files changed

Lines changed: 50 additions & 43 deletions

File tree

.github/workflows/python-test.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
sudo apt install graphviz
2828
pip install --upgrade pip
2929
pip install --upgrade setuptools
30-
python -m pip install .[test]
31-
python setup.py build_ext --inplace
30+
python -m pip install -e ".[test]"
3231
- name: Test with pytest
3332
run: pytest -vs tests/ --cov causalml/

.github/workflows/test-build-from-source.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ jobs:
1919
fail-fast: false
2020
matrix:
2121
os: [ubuntu-latest]
22-
python-version: [3.7, 3.8, 3.9]
22+
python-version: ["3.9", "3.10", "3.11", "3.12"]
2323
tf-label: ['', '-tf']
2424
include:
25-
- python-version: 3.7
26-
python-version-nd: 37
27-
- python-version: 3.8
28-
python-version-nd: 38
29-
- python-version: 3.9
25+
- python-version: "3.9"
3026
python-version-nd: 39
27+
- python-version: "3.10"
28+
python-version-nd: 310
29+
- python-version: "3.11"
30+
python-version-nd: 311
31+
- python-version: "3.12"
32+
python-version-nd: 312
3133
- tf-label: '-tf'
32-
tf-label-pip: '[tf]'
34+
tf-label-pip: ',tf'
3335

3436
steps:
3537
- name: checkout repository
@@ -68,9 +70,7 @@ jobs:
6870
run: |
6971
pip install -U pip
7072
pip install -U setuptools
71-
python -m pip install .${{ matrix.tf-label-pip}}
72-
python -m pip install .[test]
73-
python setup.py build_ext --inplace
73+
python -m pip install -e ".[test${{ matrix.tf-label-pip}}]"
7474
7575
- name: Test with pytest
7676
run: pytest -vs tests/ --cov causalml/

.github/workflows/test-conda-forge-install.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
os: [ubuntu-latest]
17-
python-version: [3.7, 3.8, 3.9]
17+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1818
include:
19-
- python-version: 3.7
20-
python-version-nd: 37
21-
- python-version: 3.8
22-
python-version-nd: 38
23-
- python-version: 3.9
19+
- python-version: "3.9"
2420
python-version-nd: 39
25-
21+
- python-version: "3.10"
22+
python-version-nd: 310
23+
- python-version: "3.11"
24+
python-version-nd: 311
25+
- python-version: "3.12"
26+
python-version-nd: 312
27+
2628
steps:
2729
- uses: actions/checkout@v2
2830
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/test-pypi-install.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ubuntu-latest]
15-
python-version: [3.7, 3.8, 3.9]
15+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1616
include:
17-
- python-version: 3.7
18-
python-version-nd: 37
19-
- python-version: 3.8
20-
python-version-nd: 38
21-
- python-version: 3.9
17+
- python-version: "3.9"
2218
python-version-nd: 39
19+
- python-version: "3.10"
20+
python-version-nd: 310
21+
- python-version: "3.11"
22+
python-version-nd: 311
23+
- python-version: "3.12"
24+
python-version-nd: 312
2325

2426
steps:
2527
- uses: actions/checkout@v2

docs/installation.rst

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Install ``causalml`` with ``tensorflow`` for ``DragonNet`` from ``PyPI``
4242
.. code-block:: bash
4343
4444
pip install causalml[tf]
45-
pip install -U numpy # this step is necessary to fix [#338](https://github.com/uber/causalml/issues/338)
4645
4746
Install ``causalml`` with ``torch`` for ``CEVAE`` from ``PyPI``
4847
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -55,37 +54,33 @@ Install ``causalml`` with ``torch`` for ``CEVAE`` from ``PyPI``
5554
Install from source
5655
-------------------
5756

58-
Create a clean ``conda`` environment.
57+
[Optional] If you don't have Graphviz installed, you can install it using ``conda``, ``brew`` (on MacOS), or ``apt`` (on Linux).
5958

6059
.. code-block:: bash
6160
62-
conda create -n causalml-py38 -y python=3.8
63-
conda activate causalml-py38
64-
conda install -c conda-forge cxx-compiler
6561
conda install python-graphviz
66-
conda install -c conda-forge xorg-libxrender
67-
conda install -c conda-forge libxcrypt
62+
brew install graphviz # MacOS
63+
sudo apt-get install graphviz # Linux
6864
69-
Then:
65+
First, clone the repository and install the package:
7066

7167
.. code-block:: bash
7268
7369
git clone https://github.com/uber/causalml.git
7470
cd causalml
75-
pip install .
76-
python setup.py build_ext --inplace
71+
pip install -e .
7772
7873
with ``tensorflow`` for ``DragonNet``:
7974

8075
.. code-block:: bash
8176
82-
pip install .[tf]
77+
pip install -e ".[tf]"
8378
8479
with ``torch`` for ``CEVAE``:
8580

8681
.. code-block:: bash
8782
88-
pip install .[torch]
83+
pip install -e ".[torch]"
8984
9085
=======
9186

@@ -100,6 +95,10 @@ Running Tests
10095

10196
Make sure pytest is installed before attempting to run tests.
10297

98+
.. code-block:: bash
99+
100+
pip install -e ".[test]"
101+
103102
Run all tests with:
104103

105104
.. code-block:: bash

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "causalml"
3-
version = "0.15.4"
3+
version = "0.15.5dev"
44
description = "Python Package for Uplift Modeling and Causal Inference with Machine Learning Algorithms"
55
readme = { file = "README.md", content-type = "text/markdown" }
66

setup.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
try:
77
from Cython.Build import cythonize
88
except ImportError:
9-
dist.Distribution().fetch_build_eggs(["cython<=0.29.34"])
9+
dist.Distribution().fetch_build_eggs(["cython"])
1010
from Cython.Build import cythonize
1111
import Cython.Compiler.Options
1212

1313
Cython.Compiler.Options.annotate = True
14+
1415
try:
15-
from numpy import get_include as np_get_include
16+
import numpy as np
1617
except ImportError:
1718
dist.Distribution().fetch_build_eggs(["numpy"])
18-
from numpy import get_include as np_get_include
19+
import numpy as np
1920

2021
# fmt: off
2122
cython_modules = [
@@ -34,7 +35,7 @@
3435
name,
3536
[source],
3637
libraries=[],
37-
include_dirs=[np_get_include()],
38+
include_dirs=[np.get_include()],
3839
extra_compile_args=["-O3"],
3940
)
4041
for name, source in cython_modules
@@ -51,5 +52,9 @@
5152
setup(
5253
packages=packages,
5354
ext_modules=cythonize(extensions, annotate=True, nthreads=nthreads),
54-
include_dirs=[np_get_include()],
55+
include_dirs=[np.get_include()],
56+
setup_requires=[
57+
"cython",
58+
"numpy",
59+
],
5560
)

0 commit comments

Comments
 (0)