在Windows 10上安装numba和llvmlite Python失败。

3

在 Windows 10 上安装 numba 和 llvmlite Python 失败

我已经尝试使用以下命令在 Windows 10 上安装 Python numba:

pip install numba

虽然部分成功,但是在安装 llvmlite 时失败。

Requirement already satisfied: numpy>=1.15 in c:\users\paul\appdata\local\programs\python\python39\lib\site-packages (from numba) (1.19.2+mkl)
Requirement already satisfied: setuptools in c:\users\paul\appdata\local\programs\python\python39\lib\site-packages (from numba) (49.2.1)
Building wheels for collected packages: numba, llvmlite
  Building wheel for numba (setup.py) ... done
  Created wheel for numba: filename=numba-0.51.2-cp39-cp39-win_amd64.whl size=2173229 sha256=249a12f2e1436ac244e2730f6e7ddb5bd53413460dcbdc4ed4e6aeebbf16d6ce
  Stored in directory: c:\users\paul\appdata\local\pip\cache\wheels\0a\51\41\9f5a61bcd9d25271d7021e05cbabcd574fb3d534d07654b780
  Building wheel for llvmlite (setup.py) ... error
  ERROR: Command errored out with exit status 1:
  
    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!

不知道LLVM安装在哪里?所以我使用Windows环境编辑器添加了LLVM_DIR,值为C:\Program Files\mingw-w64\winlibs-x86_64-posix-seh-gcc-9.3.0-llvm-10.0.0-mingw-w64-7.0.0-r4\mingw64\lib\cmake\llvm,希望它会使用我安装在C:\LLVM\clang-1100、C:\LLVM\clang-1000等位置的四个Clang版本之一。最新的二进制文件位于C:\LLVM\clang-1100\LLVM\bin。我还安装了VS 1017和1019,并且所有编译器都可以在其他IDE和构建中正常工作。我还下载了最新的wheel,llvmlite-0.34.0-cp39-cp39-win_amd64.whl,并将LLVM_DIR添加到系统PATH中:C:\Program Files\mingw-w64\winlibs-x86_64-posix-seh-gcc-9.3.0-llvm-10.0.0-mingw-w64-7.0.0-r4\mingw64\lib\cmake\llvm。这使得它更接近工作状态,但在使用MSVC时失败。
   Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Paul\AppData\Local\Temp\pip-install-xvvf77_z\llvmlite\ffi\build\ZERO_CHECK.vcxproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(399,5): warning MSB8029: The Intermediate directory or Output directory cannot reside under the Temporary directory as it could lead to issues with incremental build. [C:\Users\Paul\AppData\Local\Temp\pip-install-xvvf77_z\llvmlite\ffi\build\llvmlite.vcxproj]
    LINK : fatal error LNK1181: cannot open input file 'D:\winlibs64_stage\custombuilt\lib\libffi.dll.a' [C:\Users\Paul\AppData\Local\Temp\pip-install-xvvf77_z\llvmlite\ffi\build\llvmlite.vcxproj]
    Trying generator 'Visual Studio 15 2017 Win64'
    Traceback (most recent call last):
      File "C:\Users\Paul\AppData\Local\Temp\pip-install-xvvf77_z\llvmlite\ffi\build.py", line 191, in <module>
        main()
      File "C:\Users\Paul\AppData\Local\Temp\pip-install-xvvf77_z\llvmlite\ffi\build.py", line 179, in main
        main_win32()
      File "C:\Users\Paul\AppData\Local\Temp\pip-install-xvvf77_z\llvmlite\ffi\build.py", line 94, in main_win32
        subprocess.check_call(['cmake', '--build', build_dir, '--config', config])
      File "c:\users\paul\appdata\local\programs\python\python39\lib\subprocess.py", line 373, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '--build', 'C:\\Users\\Paul\\AppData\\Local\\Temp\\pip-install-xvvf77_z\\llvmlite\\ffi\\build', '--config', 'Release']' returned non-zero exit status 1.
    error: command 'c:\\users\\paul\\appdata\\local\\programs\\python\\python39\\python.exe' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\paul\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Paul\\AppData\\Local\\Temp\\pip-install-xvvf77_z\\llvmlite\\setup.py'"'"'; __file__='"'"'C:\\Users\\Paul\\AppData\\Local\\Temp\\pip-install-xvvf77_z\\llvmlite\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Paul\AppData\Local\Temp\pip-record-l4absc_g\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\paul\appdata\local\programs\python\python39\Include\llvmlite' Check the logs for full command output.

这表明输出文件夹位置未指定,或者VS增量构建选项未设置为“未使用”。或者我应该使用LLVM版本,但我不知道如何指定哪一个版本,并且不使用VS2017。欢迎提出如何走出这个困境的建议;-)谢谢Paul。
1个回答

2

我想安装librosa,但遇到了这个错误,不过我用以下方法解决了它:

  • 首先,我下载了最新版本的llvmlite 这里
  • 然后我运行了以下命令:

pip install llvmlite-0.35.0-cp39-cp39-win_amd64.whl

  • 接下来,为了安装librosa所需的所有软件包,我按照以下方式安装它们:

pip install --no-deps 包名

  • 或者只需按照以下示例操作:

pip install librosa --ignore-installed llvmlite


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接