在 Windows 上从源代码构建 numpy 的问题

问题描述 投票:0回答:1

我正在尝试在 Windows 平台上构建 numpy 1.26.0,但面临很多挑战。有人可以帮我吗?

  1. 我使用 https://github.com/arrayfire/arrayfire/wiki/CBLAS-for-Windows 构建了 openblas 安装了 rtools 来获取 gfortran 和 gcc 以及 microsoft Visual Studios。

我能够成功构建 openbals 并安装它 -

OpenBLAS build complete. (BLAS CBLAS LAPACK LAPACKE)

            OS               ... WINNT
            Architecture     ... x86_64
            BINARY           ... 64bit
            C compiler       ... GCC  (cmd & version : cc.exe (Built by Jeroen for the R-project) 10.3.0)
            Fortran compiler ... GFORTRAN  (cmd & version : GNU Fortran (Built by Jeroen for the R-project) 10.3.0)
            Library Name     ... libopenblas_zenp-r0.3.20.a (Multi-threading; Max num-threads is 2)
  1. 现在,当我在下载 numpy 源代码后尝试构建 numpy 1.26.0 whl 文件时 -
python -m build --wheel --no-isolation .

虽然构建能够获取 openblas lib,但仍然遇到问题,但我遇到了以下问题 -

Library m found: NO
Found pkg-config: C:\rtools40\ucrt64\bin\pkg-config.EXE (0.29.2)
Run-time dependency openblas found: YES 0.3.20
Checking if "CBLAS" with dependency openblas: links: NO
Found CMake: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.EXE (3.17.20032601)
WARNING: CMake Toolchain: Failed to determine CMake compilers state
Run-time dependency cblas found: NO (tried pkgconfig and cmake)

numpy\1.26.0\numpy-1.26.0\numpy\meson.build:189:4: ERROR: Problem encountered: No CBLAS interface detected! Install a BLAS library with CBLAS support, or use the `allow-noblas` build option (note, this may be up to 100x slower for some linear algebra operations). 

附注我知道 pypi.org 已经提供了一个 whl 文件,但我不想使用它。

#numpy

已经提到问题中尝试过的步骤

python numpy build
1个回答
0
投票

构建使用 pkg-config 来检测 OpenBLAS,但无法找到 CBLAS。检查 build/meson-logs 中的介子构建日志,以获取有关可能出现问题的更多详细信息。我的猜测是您使用的是 MSVC,但 OpenBLAS 仅为 gcc 构建(没有 openblas.lib 导入库)。有关创建导入库所涉及内容的提示,请参阅 NumPy 和 SciPy 使用的 OpenBLAS 构建中的这些步骤

© www.soinside.com 2019 - 2024. All rights reserved.