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

标签 python windows numba llvmlite

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

我尝试在 Windows 10 上使用 Python numba 安装

pip 安装 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 环境编辑器添加值为 C:\Program Files\mingw-w64\winlibs-x86_64-posix-seh-gcc-9.3.0-llvm-10.0.0-mingw-w64-7.0 的 LLVM_DIR。 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。

欢迎提出如何走出这个兔子洞的建议 ;-)

谢谢

保罗

最佳答案

我想安装 librosa 但我遇到了这个错误,但我设法用这个解决了它:

  • 首先我下载最新版本的 llvmlite Here
  • 比我运行以下命令:

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

  • 接下来,对于 librosa 需要的所有软件包,我按如下方式安装它们:

pip install --no-deps packageName

  • 或者只是为了更多示例,请执行以下操作:

pip install librosa --ignore-installed llvmlite

关于python - 在 Windows 10 上安装 numba 和 llvmlite Python 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64391669/

相关文章:

python - numba提前编译递归函数

python - 在 Python 环境中设置 NLTK 的问题

c++ - Windows DLL 上的静态链接 libgcc

node.js - Electron app.on ('ready' ...永远不会被调用并且永远不会显示 Electron 窗口。似乎与特定的 Git 存储库相关联

python - 如何制作一个虚拟的什么都不做的@jit 装饰器?

python - 使用 numba 计算向量和矩阵行之间的余弦相似度

python - 如何使用 Open3D 创建带有点云更新的基本 GUI?

python - 在 matplotlib 中使用 log2 比例制作方轴图

python - 如何等待线程列表完成? (Python)

c++ - 如何避免第三方库(无源代码)从物理内存分配内存?