Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

llvmlite failed to install. Error building llvmlite

I have a problem with installing llvmlite, which is need for installing Numba. I searched for answers to my problem, but nothing is working. The command I used to install numba and llvmlite:

pip install numba
pip install llvmlite
    enter code here

Error code: 
  ERROR: Failed building wheel for llvmlite
  Running setup.py clean for llvmlite
Failed to build llvmlite
Installing collected packages: llvmlite
    Running setup.py install for llvmlite ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python39\python.exe' -u -c 'import sys, setuptools, tokenize;
sys.argv[0] = '"'"'C:\\Users\\owner\\AppData\\Local\\Temp\\pip-install-hif24z13\
\llvmlite_0e0be86c2ed14239b3eec11a3bd23922\\setup.py'"'"'; __file__='"'"'C:\\Use
rs\\owner\\AppData\\Local\\Temp\\pip-install-hif24z13\\llvmlite_0e0be86c2ed14239
b3eec11a3bd23922\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file
__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(c
ode, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\owner\AppData\Local\
Temp\pip-record-sipsgexo\install-record.txt' --single-version-externally-managed
 --compile --install-headers 'c:\python39\Include\llvmlite'
         cwd: C:\Users\owner\AppData\Local\Temp\pip-install-hif24z13\llvmlite_0e
0be86c2ed14239b3eec11a3bd23922\
    Complete output (59 lines):
    running install
    running build
    got version from file C:\Users\owner\AppData\Local\Temp\pip-install-hif24z13
\llvmlite_0e0be86c2ed14239b3eec11a3bd23922\llvmlite/_version.py {'version': '0.3
5.0', 'full': 'ea23b026930cc00824c907172383f54c9d438e6b'}
    running build_ext
    c:\python39\python.exe C:\Users\owner\AppData\Local\Temp\pip-install-hif24z1
3\llvmlite_0e0be86c2ed14239b3eec11a3bd23922\ffi\build.py
    -- Selecting Windows SDK version 10.0.18362.0 to target Windows 6.3.9600.
    -- The C compiler identification is MSVC 19.16.27043.0
    -- The CXX compiler identification is MSVC 19.16.27043.0
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Stu
dio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual S
tudio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe - skipped

    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/owner/AppData/Local/Temp/tmp1e
4ama0u
    CMake Deprecation Warning at CMakeLists.txt:2 (cmake_minimum_required):
      Compatibility with CMake < 2.8.12 will be removed from a future version of

      CMake.

      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.


    -- Selecting Windows SDK version 10.0.18362.0 to target Windows 6.3.9600.
    CMake Error at CMakeLists.txt:9 (find_package):
      Could not find a package configuration file provided by "LLVM" with any of

      the following names:

        LLVMConfig.cmake
        llvm-config.cmake

      Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
      "LLVM_DIR" to a directory containing one of the above files.  If "LLVM"
      provides a separate development package or SDK, be sure it has been
      installed.


    -- Configuring incomplete, errors occurred!
    See also "C:/Users/owner/AppData/Local/Temp/pip-install-hif24z13/llvmlite_0e
0be86c2ed14239b3eec11a3bd23922/ffi/build/CMakeFiles/CMakeOutput.log".
    Trying generator 'Visual Studio 15 2017 Win64'
    Traceback (most recent call last):
      File "C:\Users\owner\AppData\Local\Temp\pip-install-hif24z13\llvmlite_0e0b
e86c2ed14239b3eec11a3bd23922\ffi\build.py", line 191, in <module>
        main()
      File "C:\Users\owner\AppData\Local\Temp\pip-install-hif24z13\llvmlite_0e0b
e86c2ed14239b3eec11a3bd23922\ffi\build.py", line 179, in main
        main_win32()
      File "C:\Users\owner\AppData\Local\Temp\pip-install-hif24z13\llvmlite_0e0b
e86c2ed14239b3eec11a3bd23922\ffi\build.py", line 93, in main_win32
        try_cmake(here_dir, build_dir, generator)
      File "C:\Users\owner\AppData\Local\Temp\pip-install-hif24z13\llvmlite_0e0b
e86c2ed14239b3eec11a3bd23922\ffi\build.py", line 28, in try_cmake
        subprocess.check_call(['cmake', '-G', generator, cmake_dir])
      File "c:\python39\lib\subprocess.py", line 373, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '-G', 'Visual Studio 15 20
17 Win64', 'C:\\Users\\owner\\AppData\\Local\\Temp\\pip-install-hif24z13\\llvmli
te_0e0be86c2ed14239b3eec11a3bd23922\\ffi']' returned non-zero exit status 1.
    error: command 'c:\\python39\\python.exe' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python39\python.exe' -u -c 'i
mport sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\owner\\AppData\\L
ocal\\Temp\\pip-install-hif24z13\\llvmlite_0e0be86c2ed14239b3eec11a3bd23922\\set
up.py'"'"'; __file__='"'"'C:\\Users\\owner\\AppData\\Local\\Temp\\pip-install-hi
f24z13\\llvmlite_0e0be86c2ed14239b3eec11a3bd23922\\setup.py'"'"';f=getattr(token
ize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'
\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --reco
rd 'C:\Users\owner\AppData\Local\Temp\pip-record-sipsgexo\install-record.txt' --
single-version-externally-managed --compile --install-headers 'c:\python39\Inclu
de\llvmlite' Check the logs for full command output.

Please help me, I have been looking for a way to solve this problem for 2 days, but without success, I am desperate

like image 895
Ded Helper Avatar asked Jan 19 '21 19:01

Ded Helper


People also ask

What is Llvmlite in Python?

llvmlite is a project originally tailored for Numba's needs, using the following approach: A small C wrapper around the parts of the LLVM C++ API we need that are not already exposed by the LLVM C API. A ctypes Python wrapper around the C API.

How do I get rid of Llvmlite?

Go to anaconda3→Lib→site-packages, find the corresponding old version file, and delete it directly.


2 Answers

Go to here and download llvmlite package for your python version, e.g. llvmlite‑0.35.0‑cp39‑cp39‑win_amd64.whl for Python 3.9.

Then install pip install llvmlite‑0.35.0‑cp39‑cp39‑win_amd64.whl.

Probably llvmlite is not yet officially supported on Python 3.9. That's why there are only unofficial builds like on this site.

Also if you need numba then go to here and download/install numba‑0.51.2‑cp39‑cp39‑win_amd64.whl. Latest numba 0.52.0 is not yet compiled by this site owner for Python 3.9, only version 0.51.2.

Also when installing numba you may need to pass key --no-deps to pip to ignore installing dependencies, like pip install --no-deps numba‑0.51.2‑cp39‑cp39‑win_amd64.whl because numba 0.51.2 wants a bit older version of llvmlite by default. Also few small extra dependencies are needed to be installed manually. So all steps for installing on Win Python 3.9 64-bit are:

  1. pip install llvmlite‑0.35.0‑cp39‑cp39‑win_amd64.whl (.whl file from here).
  2. pip install --no-deps numba‑0.51.2‑cp39‑cp39‑win_amd64.whl (.whl file from here).
  3. pip install numpy importlib-metadata (small few extra dependencies via regular pip install without downloading).

PS. Site by link mentioned above has only Windows packages. Also this site has many other popular wheels packages for Python, most of them are placed on this site because they are not currently available inside official PIP repository..

like image 124
Arty Avatar answered Oct 24 '22 03:10

Arty


Install llvm {version} greater than 7 using command

suda apt install llvm-{version}

Than to install numba or llvmlite {package} use command

LLVM_CONFIG={path to llvm-config file} pip install {package}

For example (For llvm version=8)

LLVM_CONFIG=/usr/bin/llvm-config-8 pip install numba==0.48
like image 7
Kausain Avatar answered Oct 24 '22 02:10

Kausain