uber / causalml

Uplift modeling and causal inference with machine learning algorithms
Other
4.99k stars 769 forks source link

Unable to install causalml #609

Closed g0odplayer00 closed 1 year ago

g0odplayer00 commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

unable to install causalml in any means

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem. 스크린샷, 2023-03-29 03-01-23

Environment (please complete the following information): running on google colab

Additional context Add any other context about the problem here.

jakirhasantalukder commented 1 year ago

same problem. I am also facing

sagagk commented 1 year ago

The same.

sagagk commented 1 year ago

I could use the package using Anaconda. It appears to work better with Python 3.8 (Current Google Colab uses 3.9, the typical downgrading generates a messy behaviour.. ). I use a terminal from Anaconda (tested in a Apple Mac Pro):

conda create -n my_env python=3.8 conda install -n my_env -c conda-forge causalml conda activate my_env conda install jupyter jupyter notebook

If someone could run this package in Colab, I appreciate it. *However, I also tried in Windows and it appears that causalml is not available in condeforge. :(

kalimosd commented 1 year ago

same in mac

talhaanwarch commented 1 year ago

Got same issue on Ubuntu 22.04 Here is full error

  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [798 lines of output]

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      # cython: language_level=3
      # cython: linetrace=True

      from sklearn.tree._tree cimport Tree, TreeBuilder
      from sklearn.tree._tree cimport Splitter, SplitRecord
      from sklearn.tree._utils cimport StackRecord, Stack
      ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:9:0: 'sklearn/tree/_utils/StackRecord.pxd' not found

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
      # cython: language_level=3
      # cython: linetrace=True

      from sklearn.tree._tree cimport Tree, TreeBuilder
      from sklearn.tree._tree cimport Splitter, SplitRecord
      from sklearn.tree._utils cimport StackRecord, Stack
      ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:9:0: 'sklearn/tree/_utils/Stack.pxd' not found

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef bint is_leaf
              cdef bint first = 1
              cdef SIZE_t max_depth_seen = -1
              cdef int rc = 0

              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
                  ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:90:13: 'Stack' is not a type identifier

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef bint first = 1
              cdef SIZE_t max_depth_seen = -1
              cdef int rc = 0

              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
              cdef StackRecord stack_record
                  ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:91:13: 'StackRecord' is not a type identifier

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef double min_weight_leaf = self.min_weight_leaf
              cdef SIZE_t min_samples_split = self.min_samples_split
              cdef double min_impurity_decrease = self.min_impurity_decrease

              # Recursive partition (without actual recursion)
              splitter.init(X, y, sample_weight_ptr)
                                 ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:70:28: Cannot convert 'DOUBLE_t *' to memoryviewslice

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef bint is_leaf
              cdef bint first = 1
              cdef SIZE_t max_depth_seen = -1
              cdef int rc = 0

              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
                                ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:90:27: 'Stack' is not a constant, variable or function identifier

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
              cdef StackRecord stack_record

              with nogil:
                  # push root node onto stack
                  rc = stack.push(0, n_node_samples, 0, _TREE_UNDEFINED, 0, INFINITY, 0)
                                ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:95:27: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
              cdef StackRecord stack_record

              with nogil:
                  # push root node onto stack
                  rc = stack.push(0, n_node_samples, 0, _TREE_UNDEFINED, 0, INFINITY, 0)
                                ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:95:27: Calling gil-requiring function not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
              cdef StackRecord stack_record

              with nogil:
                  # push root node onto stack
                  rc = stack.push(0, n_node_samples, 0, _TREE_UNDEFINED, 0, INFINITY, 0)
                           ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:95:22: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
              cdef StackRecord stack_record

              with nogil:
                  # push root node onto stack
                  rc = stack.push(0, n_node_samples, 0, _TREE_UNDEFINED, 0, INFINITY, 0)
                                ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:95:27: Constructing Python tuple not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
              cdef StackRecord stack_record

              with nogil:
                  # push root node onto stack
                  rc = stack.push(0, n_node_samples, 0, _TREE_UNDEFINED, 0, INFINITY, 0)
                                    ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:95:31: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
              cdef StackRecord stack_record

              with nogil:
                  # push root node onto stack
                  rc = stack.push(0, n_node_samples, 0, _TREE_UNDEFINED, 0, INFINITY, 0)
                                                       ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:95:50: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
              cdef Stack stack = Stack(INITIAL_STACK_SIZE)
              cdef StackRecord stack_record

              with nogil:
                  # push root node onto stack
                  rc = stack.push(0, n_node_samples, 0, _TREE_UNDEFINED, 0, INFINITY, 0)
                                                                           ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:95:70: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  if rc == -1:
                      # got return code -1 - out-of-memory
                      with gil:
                          raise MemoryError()

                  while not stack.is_empty():
                                         ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:101:36: Truth-testing Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  if rc == -1:
                      # got return code -1 - out-of-memory
                      with gil:
                          raise MemoryError()

                  while not stack.is_empty():
                                         ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:101:36: Calling gil-requiring function not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  if rc == -1:
                      # got return code -1 - out-of-memory
                      with gil:
                          raise MemoryError()

                  while not stack.is_empty():
                                ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:101:27: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  if rc == -1:
                      # got return code -1 - out-of-memory
                      with gil:
                          raise MemoryError()

                  while not stack.is_empty():
                                         ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:101:36: Constructing Python tuple not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # got return code -1 - out-of-memory
                      with gil:
                          raise MemoryError()

                  while not stack.is_empty():
                      stack.pop(&stack_record)
                              ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:102:25: Discarding owned Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # got return code -1 - out-of-memory
                      with gil:
                          raise MemoryError()

                  while not stack.is_empty():
                      stack.pop(&stack_record)
                              ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:102:25: Calling gil-requiring function not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # got return code -1 - out-of-memory
                      with gil:
                          raise MemoryError()

                  while not stack.is_empty():
                      stack.pop(&stack_record)
                          ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:102:21: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # got return code -1 - out-of-memory
                      with gil:
                          raise MemoryError()

                  while not stack.is_empty():
                      stack.pop(&stack_record)
                              ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:102:25: Constructing Python tuple not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # got return code -1 - out-of-memory
                      with gil:
                          raise MemoryError()

                  while not stack.is_empty():
                      stack.pop(&stack_record)
                               ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:102:26: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          raise MemoryError()

                  while not stack.is_empty():
                      stack.pop(&stack_record)

                      start = stack_record.start
                                         ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:104:36: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          raise MemoryError()

                  while not stack.is_empty():
                      stack.pop(&stack_record)

                      start = stack_record.start
                                         ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:104:36: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

                  while not stack.is_empty():
                      stack.pop(&stack_record)

                      start = stack_record.start
                      end = stack_record.end
                                       ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:105:34: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

                  while not stack.is_empty():
                      stack.pop(&stack_record)

                      start = stack_record.start
                      end = stack_record.end
                                       ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:105:34: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  while not stack.is_empty():
                      stack.pop(&stack_record)

                      start = stack_record.start
                      end = stack_record.end
                      depth = stack_record.depth
                                         ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:106:36: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                  while not stack.is_empty():
                      stack.pop(&stack_record)

                      start = stack_record.start
                      end = stack_record.end
                      depth = stack_record.depth
                                         ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:106:36: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      stack.pop(&stack_record)

                      start = stack_record.start
                      end = stack_record.end
                      depth = stack_record.depth
                      parent = stack_record.parent
                                          ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:107:37: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      stack.pop(&stack_record)

                      start = stack_record.start
                      end = stack_record.end
                      depth = stack_record.depth
                      parent = stack_record.parent
                                          ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:107:37: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

                      start = stack_record.start
                      end = stack_record.end
                      depth = stack_record.depth
                      parent = stack_record.parent
                      is_left = stack_record.is_left
                                           ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:108:38: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...

                      start = stack_record.start
                      end = stack_record.end
                      depth = stack_record.depth
                      parent = stack_record.parent
                      is_left = stack_record.is_left
                                           ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:108:38: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      start = stack_record.start
                      end = stack_record.end
                      depth = stack_record.depth
                      parent = stack_record.parent
                      is_left = stack_record.is_left
                      impurity = stack_record.impurity
                                            ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:109:39: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      start = stack_record.start
                      end = stack_record.end
                      depth = stack_record.depth
                      parent = stack_record.parent
                      is_left = stack_record.is_left
                      impurity = stack_record.impurity
                                            ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:109:39: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      end = stack_record.end
                      depth = stack_record.depth
                      parent = stack_record.parent
                      is_left = stack_record.is_left
                      impurity = stack_record.impurity
                      n_constant_features = stack_record.n_constant_features
                                                       ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:110:50: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      end = stack_record.end
                      depth = stack_record.depth
                      parent = stack_record.parent
                      is_left = stack_record.is_left
                      impurity = stack_record.impurity
                      n_constant_features = stack_record.n_constant_features
                                                       ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:110:50: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # inspection and interpretation
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                        ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:147:35: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # inspection and interpretation
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                        ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:147:35: Calling gil-requiring function not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # inspection and interpretation
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                   ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:147:30: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # inspection and interpretation
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                        ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:147:35: Constructing Python tuple not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # inspection and interpretation
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                              ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:147:41: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # inspection and interpretation
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                                    ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:147:47: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # inspection and interpretation
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                                               ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:147:58: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      # inspection and interpretation
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                                                    ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:147:63: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                          split.impurity_right, n_constant_features)
                                              ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:148:41: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                      splitter.node_value(tree.value + node_id * tree.value_stride)

                      if not is_leaf:
                          # Push right child on stack
                          rc = stack.push(split.pos, end, depth + 1, node_id, 0,
                                          split.impurity_right, n_constant_features)
                                                               ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:148:58: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                          split.impurity_right, n_constant_features)
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                        ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:153:35: Coercion from Python not allowed without the GIL

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                          split.impurity_right, n_constant_features)
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                        ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:153:35: Calling gil-requiring function not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                          split.impurity_right, n_constant_features)
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                   ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:153:30: Accessing Python attribute not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                          split.impurity_right, n_constant_features)
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                        ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:153:35: Constructing Python tuple not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                          split.impurity_right, n_constant_features)
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                         ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:153:36: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                          split.impurity_right, n_constant_features)
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                                     ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:153:48: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                          split.impurity_right, n_constant_features)
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                                                 ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:153:60: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                                          split.impurity_right, n_constant_features)
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                                                      ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:153:65: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                          split.impurity_left, n_constant_features)
                                              ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:154:41: Converting to Python object not allowed without gil

      Error compiling Cython file:
      ------------------------------------------------------------
      ...
                          if rc == -1:
                              break

                          # Push left child on stack
                          rc = stack.push(start, split.pos, depth + 1, node_id, 1,
                                          split.impurity_left, n_constant_features)
                                                              ^
      ------------------------------------------------------------

      causalml/inference/tree/causal/builder.pyx:154:57: Converting to Python object not allowed without gil
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-oj6b98hi/causalml_fb14bc15453e4f0585490dd11105553b/setup.py", line 80, in <module>
          ext_modules=cythonize(extensions, annotate=True),
        File "/home/talha/venv/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1115, in cythonize
          cythonize_one(*args)
        File "/home/talha/venv/lib/python3.10/site-packages/Cython/Build/Dependencies.py", line 1238, in cythonize_one
          raise CompileError(None, pyx_file)
      Cython.Compiler.Errors.CompileError: causalml/inference/tree/causal/builder.pyx
      Compiling causalml/inference/tree/causal/criterion.pyx because it depends on /home/talha/venv/lib/python3.10/site-packages/Cython/Includes/cpython/type.pxd.
      Compiling causalml/inference/tree/causal/builder.pyx because it depends on /home/talha/venv/lib/python3.10/site-packages/Cython/Includes/cpython/type.pxd.
      Compiling causalml/inference/tree/uplift.pyx because it depends on /home/talha/venv/lib/python3.10/site-packages/Cython/Includes/cpython/type.pxd.
      [1/3] Cythonizing causalml/inference/tree/causal/builder.pyx
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
talhaanwarch commented 1 year ago

Installing from source installed the package.

mhfarahani commented 1 year ago

Same issue when trying to install the package on Sagemaker studio or Googlecolab. Downgrading the python to 3.8 did not help. Also, I tried to install it from the source but it did not work.

mhfarahani commented 1 year ago

python 3.8.13, Sagemaker studio

Requirement already satisfied: setuptools>=41.0.0 in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (67.6.1) Collecting forestci==0.6 Using cached forestci-0.6-py3-none-any.whl (12 kB) Collecting pathos==0.2.9 Using cached pathos-0.2.9-py3-none-any.whl (76 kB) Requirement already satisfied: pip>=10.0 in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (23.0.1) Requirement already satisfied: numpy>=1.18.5 in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 5)) (1.24.2) Requirement already satisfied: scipy>=1.4.1 in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 6)) (1.7.1) Requirement already satisfied: matplotlib in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 7)) (3.4.3) Requirement already satisfied: pandas>=0.24.1 in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 8)) (1.3.4) Requirement already satisfied: scikit-learn<=1.0.2 in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 9)) (0.24.2) Requirement already satisfied: statsmodels>=0.9.0 in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 10)) (0.12.2) Requirement already satisfied: seaborn in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 11)) (0.11.2) Requirement already satisfied: Cython>=0.28.0 in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 12)) (0.29.24) Collecting xgboost Using cached xgboost-1.7.5-py3-none-manylinux2014_x86_64.whl (200.3 MB) Collecting pydotplus Using cached pydotplus-2.0.2-py3-none-any.whl Requirement already satisfied: tqdm in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 15)) (4.62.3) Collecting shap Using cached shap-0.41.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (575 kB) Requirement already satisfied: dill in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 17)) (0.3.6) Collecting lightgbm Using cached lightgbm-3.3.5-py3-none-manylinux1_x86_64.whl (2.0 MB) Collecting pygam Using cached pygam-0.9.0-py3-none-any.whl (522 kB) Requirement already satisfied: packaging in /opt/conda/lib/python3.8/site-packages (from -r requirements.txt (line 20)) (21.0) Collecting torch Killed Compiling causalml/inference/tree/causal/_criterion.pyx because it changed. Compiling causalml/inference/tree/causal/_builder.pyx because it changed. Compiling causalml/inference/tree/uplift.pyx because it changed. [1/3] Cythonizing causalml/inference/tree/causal/_builder.pyx [2/3] Cythonizing causalml/inference/tree/causal/_criterion.pyx [3/3] Cythonizing causalml/inference/tree/uplift.pyx running build_ext building 'causalml.inference.tree.causal._criterion' extension creating build creating build/temp.linux-x86_64-cpython-38 creating build/temp.linux-x86_64-cpython-38/causalml creating build/temp.linux-x86_64-cpython-38/causalml/inference creating build/temp.linux-x86_64-cpython-38/causalml/inference/tree creating build/temp.linux-x86_64-cpython-38/causalml/inference/tree/causal gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.8/site-packages/numpy/core/include -I/opt/conda/lib/python3.8/site-packages/numpy/core/include -I/opt/conda/include/python3.8 -c causalml/inference/tree/causal/_criterion.c -o build/temp.linux-x86_64-cpython-38/causalml/inference/tree/causal/_criterion.o -O3 /opt/conda/lib/python3.8/site-packages/Cython/Compiler/Main.py:369: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /root/Causality/causalml/causalml/inference/tree/uplift.pyx tree = Parsing.p_module(s, pxd, full_module_name) /opt/conda/lib/python3.8/site-packages/setuptools/init.py:85: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try pip install --use-pep517. dist.fetch_build_eggs(dist.setup_requires) /opt/conda/lib/python3.8/site-packages/setuptools/installer.py:45: UserWarning: Module numpy was already imported from /opt/conda/lib/python3.8/site-packages/numpy/init.py, but /root/Causality/causalml/.eggs/numpy-1.22.4-py3.8-linux-x86_64.egg is being added to sys.path pkg_resources.working_set.add(dist, replace=True) error: command 'gcc' failed: No such file or directory running install running bdist_egg running egg_info creating causalml.egg-info writing causalml.egg-info/PKG-INFO writing dependency_links to causalml.egg-info/dependency_links.txt writing requirements to causalml.egg-info/requires.txt writing top-level names to causalml.egg-info/top_level.txt writing manifest file 'causalml.egg-info/SOURCES.txt' reading manifest file 'causalml.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' /opt/conda/lib/python3.8/site-packages/setuptools/init.py:85: _DeprecatedInstaller: setuptools.installer and fetch_build_eggs are deprecated. Requirements should be satisfied by a PEP 517 installer. If you are using pip, you can try pip install --use-pep517. dist.fetch_build_eggs(dist.setup_requires) /opt/conda/lib/python3.8/site-packages/setuptools/installer.py:45: UserWarning: Module numpy was already imported from /opt/conda/lib/python3.8/site-packages/numpy/init.py, but /root/Causality/causalml/.eggs/numpy-1.22.4-py3.8-linux-x86_64.egg is being added to sys.path pkg_resources.working_set.add(dist, replace=True) /opt/conda/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( /opt/conda/lib/python3.8/site-packages/setuptools/command/easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( warning: no files found matching '*.h' under directory 'causalml' adding license file 'LICENSE' writing manifest file 'causalml.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib running build_py creating build/lib.linux-x86_64-cpython-38 creating build/lib.linux-x86_64-cpython-38/causalml copying causalml/propensity.py -> build/lib.linux-x86_64-cpython-38/causalml copying causalml/match.py -> build/lib.linux-x86_64-cpython-38/causalml copying causalml/features.py -> build/lib.linux-x86_64-cpython-38/causalml copying causalml/init.py -> build/lib.linux-x86_64-cpython-38/causalml creating build/lib.linux-x86_64-cpython-38/causalml/dataset copying causalml/dataset/regression.py -> build/lib.linux-x86_64-cpython-38/causalml/dataset copying causalml/dataset/synthetic.py -> build/lib.linux-x86_64-cpython-38/causalml/dataset copying causalml/dataset/classification.py -> build/lib.linux-x86_64-cpython-38/causalml/dataset copying causalml/dataset/init.py -> build/lib.linux-x86_64-cpython-38/causalml/dataset creating build/lib.linux-x86_64-cpython-38/causalml/feature_selection copying causalml/feature_selection/filters.py -> build/lib.linux-x86_64-cpython-38/causalml/feature_selection copying causalml/feature_selection/init.py -> build/lib.linux-x86_64-cpython-38/causalml/feature_selection creating build/lib.linux-x86_64-cpython-38/causalml/optimize copying causalml/optimize/policylearner.py -> build/lib.linux-x86_64-cpython-38/causalml/optimize copying causalml/optimize/utils.py -> build/lib.linux-x86_64-cpython-38/causalml/optimize copying causalml/optimize/pns.py -> build/lib.linux-x86_64-cpython-38/causalml/optimize copying causalml/optimize/unit_selection.py -> build/lib.linux-x86_64-cpython-38/causalml/optimize copying causalml/optimize/value_optimization.py -> build/lib.linux-x86_64-cpython-38/causalml/optimize copying causalml/optimize/init.py -> build/lib.linux-x86_64-cpython-38/causalml/optimize creating build/lib.linux-x86_64-cpython-38/causalml/metrics copying causalml/metrics/regression.py -> build/lib.linux-x86_64-cpython-38/causalml/metrics copying causalml/metrics/sensitivity.py -> build/lib.linux-x86_64-cpython-38/causalml/metrics copying causalml/metrics/const.py -> build/lib.linux-x86_64-cpython-38/causalml/metrics copying causalml/metrics/classification.py -> build/lib.linux-x86_64-cpython-38/causalml/metrics copying causalml/metrics/visualize.py -> build/lib.linux-x86_64-cpython-38/causalml/metrics copying causalml/metrics/init.py -> build/lib.linux-x86_64-cpython-38/causalml/metrics creating build/lib.linux-x86_64-cpython-38/causalml/inference copying causalml/inference/init.py -> build/lib.linux-x86_64-cpython-38/causalml/inference creating build/lib.linux-x86_64-cpython-38/causalml/inference/tree copying causalml/inference/tree/utils.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tree copying causalml/inference/tree/plot.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tree copying causalml/inference/tree/init.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tree creating build/lib.linux-x86_64-cpython-38/causalml/inference/nn copying causalml/inference/nn/cevae.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/nn copying causalml/inference/nn/init.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/nn creating build/lib.linux-x86_64-cpython-38/causalml/inference/tf copying causalml/inference/tf/utils.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tf copying causalml/inference/tf/dragonnet.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tf copying causalml/inference/tf/init.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tf creating build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/xlearner.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/utils.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/tlearner.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/rlearner.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/base.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/drlearner.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/tmle.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/slearner.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/init.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta copying causalml/inference/meta/explainer.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/meta creating build/lib.linux-x86_64-cpython-38/causalml/inference/iv copying causalml/inference/iv/iv_regression.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/iv copying causalml/inference/iv/drivlearner.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/iv copying causalml/inference/iv/init.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/iv creating build/lib.linux-x86_64-cpython-38/causalml/inference/tree/causal copying causalml/inference/tree/causal/causaltree.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tree/causal copying causalml/inference/tree/causal/_tree.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tree/causal copying causalml/inference/tree/causal/causalforest.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tree/causal copying causalml/inference/tree/causal/init.py -> build/lib.linux-x86_64-cpython-38/causalml/inference/tree/causal running build_ext building 'causalml.inference.tree.causal._criterion' extension gcc -pthread -B /opt/conda/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/opt/conda/lib/python3.8/site-packages/numpy/core/include -I/opt/conda/lib/python3.8/site-packages/numpy/core/include -I/opt/conda/include/python3.8 -c causalml/inference/tree/causal/_criterion.c -o build/temp.linux-x86_64-cpython-38/causalml/inference/tree/causal/_criterion.o -O3 error: command 'gcc' failed: No such file or directory

CalledProcessError Traceback (most recent call last) Cell In[2], line 1 ----> 1 get_ipython().run_cell_magic('sh', '', '\ncd causalml\npip install -r requirements.txt\npython setup.py build_ext --inplace\npython setup.py install\n')

File /opt/conda/lib/python3.8/site-packages/IPython/core/interactiveshell.py:2475, in InteractiveShell.run_cell_magic(self, magic_name, line, cell) 2473 with self.builtin_trap: 2474 args = (magic_arg_s, cell) -> 2475 result = fn(*args, **kwargs) 2477 # The code below prevents the output from being displayed 2478 # when using magics with decodator @output_can_be_silenced 2479 # when the last Python token in the expression is a ';'. 2480 if getattr(fn, magic.MAGIC_OUTPUT_CAN_BE_SILENCED, False):

File /opt/conda/lib/python3.8/site-packages/IPython/core/magics/script.py:153, in ScriptMagics._make_script_magic..named_script_magic(line, cell) 151 else: 152 line = script --> 153 return self.shebang(line, cell)

File /opt/conda/lib/python3.8/site-packages/IPython/core/magics/script.py:305, in ScriptMagics.shebang(self, line, cell) 300 if args.raise_error and p.returncode != 0: 301 # If we get here and p.returncode is still None, we must have 302 # killed it but not yet seen its return code. We don't wait for it, 303 # in case it's stuck in uninterruptible sleep. -9 = SIGKILL 304 rc = p.returncode or -9 --> 305 raise CalledProcessError(rc, cell)

CalledProcessError: Command 'b'\ncd causalml\npip install -r requirements.txt\npython setup.py build_ext --inplace\npython setup.py install\n'' returned non-zero exit status 1.

jakirhasantalukder commented 1 year ago

Initially run the following code:

!pip install Causalml !pip install numpy==1.23.5

!git clone https://github.com/uber/causalml.git !cd causalml !pip install -r /content/causalml/requirements.txt !python setup.py build_ext --inplace !pip /content/causalml/setup.py install !python setup.py install

! git clone https://github.com/uber/causalml.git ! cd causalml ! pip install -r /content/causalml/requirements-test.txt ! pip install causalml[tf] ! pip install -U numpy==1.23.5

!pip install numpy==1.23.4

!pip install -U scikit-learn==1.0.2

!pip uninstall scikit-learn !pip install scikit-learn==1.0.2

when show- Proceed (Y/n)? Put Y and then enter

Then run-

import pandas as pd import numpy as np from matplotlib import pyplot as plt import seaborn as sns import torch

from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from xgboost import XGBRegressor from lightgbm import LGBMRegressor from sklearn.metrics import mean_absolute_error from sklearn.metrics import mean_squared_error as mse from scipy.stats import entropy import warnings import logging

from causalml.inference.meta import BaseXRegressor, BaseRRegressor, BaseSRegressor, BaseTRegressor from causalml.inference.nn import CEVAE from causalml.propensity import ElasticNetPropensityModel from causalml.metrics import * from causalml.dataset import simulate_hidden_confounder

%matplotlib inline

warnings.filterwarnings('ignore') logger = logging.getLogger('causalml') logger.setLevel(logging.DEBUG)

plt.style.use('fivethirtyeight') sns.set_palette('Paired') plt.rcParams['figure.figsize'] = (12,8)

When it is not running, go to "Runtime" and click on "Restart and run all"

It will definitely work in google colab, but do not forget # when show- Proceed (Y/n)? Put Y and then enter

ras44 commented 1 year ago

The OP @g0odplayer00 describes not being able to run causalML in a Google Colab.

I am able to run !pip install causalml in a Google colab, but did have to fix numpy==1.23 and the restart the runtime.

For a working example, see:

https://colab.research.google.com/drive/1mVKxa5cKXZSLcnuEYGlvePhWPL00FH_E?usp=sharing

For other issues, like that described by @talhaanwarch, please make sure that you have gcc and g++ installed, for example:

sudo apt-get install -y gcc g++

Please note that colab currently run's python 3.10.12, which is not supported and which will break when attempting to run tests. Currently only py 3.7, 3.8, and 3.9 are supported.

jakirhasantalukder commented 1 year ago

Wonderful!

From: ras44 @.> Sent: Thursday, 13 July 2023 2:16 AM To: uber/causalml @.> Cc: Talukder, Md Jakir Hasan - talmh001 @.>; Comment @.> Subject: Re: [uber/causalml] Unable to install causalml (Issue #609)

The OP @g0odplayer00https://github.com/g0odplayer00 describes not being able to run causalML in a Google Colab.

I am able to run !pip install causalml in a Google colab, but did have to fix numpy==1.23 and the restart the runtime.

For a working example, see:

https://colab.research.google.com/drive/1mVKxa5cKXZSLcnuEYGlvePhWPL00FH_E?usp=sharinghttps://colab.research.google.com/drive/1mVKxa5cKXZSLcnuEYGlvePhWPL00FH_E?usp=sharing

For other issues, like that described by @talhaanwarchhttps://github.com/talhaanwarch, please make sure that you have gcc and g++ installed, for example:

sudo apt-get install -y gcc g++

— Reply to this email directly, view it on GitHubhttps://github.com/uber/causalml/issues/609#issuecomment-1632877213, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AX3WNRENBTXIJZBTRXYI7ELXP3IERANCNFSM6AAAAAAWK5QQHE. You are receiving this because you commented.Message ID: @.**@.>>

vincewu51 commented 1 year ago

Closed since the issue is solved.