llvmlite 安装失败。构建 llvmlite 时出错
Posted
技术标签:
【中文标题】llvmlite 安装失败。构建 llvmlite 时出错【英文标题】:llvmlite failed to install. Error building llvmlite 【发布时间】:2021-04-24 03:43:55 【问题描述】:我在安装 llvmlite 时遇到问题,这是安装 Numba 所必需的。 我搜索了我的问题的答案,但没有任何效果。 我用来安装numba和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.
请帮助我,我一直在寻找解决这个问题的方法2天,但没有成功,我很绝望
【问题讨论】:
【参考方案1】:llvmlite 尚不支持 python 3.9。 Uninstall python 3.9 并下载 python 3.8.7 并重试。这解决了我的问题。
【讨论】:
另一种方法是使用pyenv 并安装多个版本的python。【参考方案2】:转到to here 并为您的 python 版本下载 llvmlite 包,例如llvmlite‑0.35.0‑cp39‑cp39‑win_amd64.whl
用于 Python 3.9。
然后安装pip install llvmlite‑0.35.0‑cp39‑cp39‑win_amd64.whl
。
Python 3.9 可能尚未正式支持 llvmlite。这就是为什么只有像这个网站这样的非官方版本。
另外,如果您需要 numba,请使用 go to here 并下载/安装 numba‑0.51.2‑cp39‑cp39‑win_amd64.whl
。此站点所有者尚未为 Python 3.9 编译最新的 numba 0.52.0,只有版本 0.51.2。
此外,在安装 numba 时,您可能需要将密钥 --no-deps
传递给 pip 以忽略安装依赖项,例如 pip install --no-deps numba‑0.51.2‑cp39‑cp39‑win_amd64.whl
,因为 numba 0.51.2 默认需要旧版本的 llvmlite。还需要手动安装一些小的额外依赖项。所以在 Win Python 3.9 64 位上安装的所有步骤都是:
pip install llvmlite‑0.35.0‑cp39‑cp39‑win_amd64.whl
(来自here 的.whl 文件)。
pip install --no-deps numba‑0.51.2‑cp39‑cp39‑win_amd64.whl
(来自here 的.whl 文件)。
pip install numpy importlib-metadata
(通过常规 pip 安装少量额外依赖项,无需下载)。
PS。上面提到的站点链接只有 Windows 包。此外,这个站点还有许多其他流行的 Python ***包,其中大部分都放在这个站点上,因为它们目前在官方 PIP 存储库中不可用。..
【讨论】:
我在别处阅读了这个答案并按照步骤操作。仍然失败并出现同样的错误。 @N.Fisher 我几天前刚刚安装了 Python 3.9。并通过安装我上面的答案中提到的软件包和链接成功安装了 numba + llvmlite。 IE。我从上面的链接下载并安装了pip install llvmlite‑0.35.0‑cp39‑cp39‑win_amd64.whl
,然后安装了pip install --no-deps numba‑0.51.2‑cp39‑cp39‑win_amd64.whl
。然后通过pip install numpy importlib-metadata
进行一些小的额外依赖。然后 Numba 工作正常并编译了相当复杂的运行代码。这适用于 2 台不同的 Win PC。这些步骤有哪些错误?
我遇到了密码学问题,这就是它失败的原因。没有安装额外的依赖项或使用 whl 进行加密,只是 llvmlite【参考方案3】:
另一种方法是安装与 Python 3.9 直接兼容的 llvmlite 版本。
今天我用pip install llvmlite==0.36.0rc1
成功地做到了;您可能想使用其他一些最新版本。
【讨论】:
llvmlite.readthedocs.io/en/latest/…【参考方案4】:使用命令安装大于 7 的 llvm version
suda apt install llvm-version
安装 numba 或 llvmlite package 使用命令
LLVM_CONFIG=path to llvm-config file pip install package
例如(对于 llvm 版本=8)
LLVM_CONFIG=/usr/bin/llvm-config-8 pip install numba==0.48
【讨论】:
以上是关于llvmlite 安装失败。构建 llvmlite 时出错的主要内容,如果未能解决你的问题,请参考以下文章
Xcode:Pod 安装后构建失败(错误:链接器命令失败,退出代码 1)