motiwari / BanditPAM

BanditPAM C++ implementation and Python package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug report: `pip`-installed `clang` not found on Windows

motiwari opened this issue · comments

One of our users is encountering (this error)[https://github.com/ThrunGroup/BanditPAM/blob/main/setup.py#L54] even after running pip install clang on Windows:

>pip install clang
Collecting clang
  Using cached clang-11.0-py3-none-any.whl (32 kB)
Installing collected packages: clang
Successfully installed clang-11.0
WARNING: You are using pip version 20.1.1; however, version 21.3.1 is available.
You should consider upgrading via the 'c:\python38\python.exe -m pip install --upgrade pip' command.

>pip install --no-cache-dir banditpam
Collecting banditpam
  Downloading banditpam-1.0.2.tar.gz (195 kB)
     |████████████████████████████████| 195 kB 1.1 MB/s
    ERROR: Command errored out with exit status 1:
     command: 'c:\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\erdem\\AppData\\Local\\Temp\\pip-install-stlfnej2\\banditpam\\setup.py'"'"'; __file__='"'"'C:\\Users\\erdem\\AppData\\Local\\Temp\\pip-install-stlfnej2\\banditpam\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\erdem\AppData\Local\Temp\pip-pip-egg-info-odobbtep'
         cwd: C:\Users\erdem\AppData\Local\Temp\pip-install-stlfnej2\banditpam\
    Complete output (11 lines):
    C:\Users\erdem\AppData\Local\Temp\pip-install-stlfnej2\banditpam\setup.py:225: SyntaxWarning: assertion is always true, perhaps remove parentheses?
      assert(compiler_check() == 'clang', "Need to install LLVM clang!")
    C:\Users\erdem\AppData\Local\Temp\pip-install-stlfnej2\banditpam\setup.py:251: SyntaxWarning: assertion is always true, perhaps remove parentheses?
      assert(compiler_name == 'clang', "Need to install LLVM clang!")
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\erdem\AppData\Local\Temp\pip-install-stlfnej2\banditpam\setup.py", line 294, in <module>
        compiler_name = compiler_check()
      File "C:\Users\erdem\AppData\Local\Temp\pip-install-stlfnej2\banditpam\setup.py", line 54, in compiler_check
        raise Exception("No C++ compiler was found. Please install LLVM clang.")
    Exception: No C++ compiler was found. Please install LLVM clang.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 21.3.1 is available.
You should consider upgrading via the 'c:\python38\python.exe -m pip install --upgrade pip' command.

I believe the reason is twofold:

  1. The "CC" environment variable may not be set on your system, so distutils.sysconfig.get_config_vars()["CC"] in the line mentioned above probably resulted in a KeyError.
  2. At this point, the except block is reached. If clang is not set in a PATH var, distutils.spawn.find_executable("clang") returns None, leading to the exception.

Please let me know if that is helpful!