uber / causalml

Uplift modeling and causal inference with machine learning algorithms

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pip install fails on pyton 3.11, command 'cl.exe' failed: None, cannot build wheels for causalml

priya-velu5 opened this issue · comments

*pip install fails. Please update the documentation with requirements.txt file location as casualml/docs

To Reproduce
$ git clone https://github.com/uber/causalml.git
$ cd causalml
$ pip install -r requirements.txt
$ pip install causalml

Expected behavior
causalml installed

Snippet of the output
image

Environment:

  • OS: Windows 64 bit
  • Python Version: 3.11.1

requirements.txt is deprecated, and pyproject.toml replaced it in #553.

Can you try to install the latest version from the repo by following the instructions in README.md?

# Create a clean conda environment and install conda dependencies:
conda create -n causalml-py38 python=3.8
conda activate causalml-py38
conda install -c conda-forge cxx-compiler
conda install python-graphviz
conda install -c conda-forge xorg-libxrender

# Install CausalML from source:
git clone https://github.com/uber/causalml.git
cd causalml
pip install .
python setup.py build_ext --inplace

followed all the steps till pip install .

The error I got -
image

It seems that you don't have cl.exe, the Microsoft C compiler, installed on your system (ref [1]). You can either install it before using pip install, or use conda-forge install:

conda install -c conda-forge causalml

The installation succeeded after uninstalling and re-installing my:

  1. Python with Miniconda (I use miniconda since I just want the conda command prompt), and
  2. Visual Studio Build tools 2019 and 2022. (VS 2022 build tools are probably not needed).

Important note:

  • The installation needed to be done through the Developer Command Prompt for VS 2019. Using developer command prompt ensures that pip can find cl.exe file (source). We cannot manually set the PATH environment variable.
  • The commands
    conda install -c conda-forge cxx-compiler
    conda install python-graphviz
    conda install -c conda-forge xorg-libxrender

needed visual studio 2019 build tools to be successful. I ran into "The system cannot find the path specified." errors when I tried installing with the 2022 developer command prompt. It was looking for files specifically inside the "2019" folder.

See this file to view the errors I ran into while installing through Developer Command Prompt for VS 2022

Installing Build Tools for Visual Studio 2019:

  • Select "Desktop Development with C++"

Installing miniconda:

  • Set conda to path since you'll need to access conda through the VS developer command prompt and not just Anaconda prompt.

Thanks, @priya-velu5, for sharing this. This will help other Windows users greatly.

@ras44, can you try this and update #678 accordingly? Thanks.