当前位置: 首页 > 工具软件 > OpenBLAS > 使用案例 >

ERROR: Dependency “OpenBLAS“ not found (MacOS,m1) Python 安装问题

郜琦
2023-12-01

使用pip 安装包 (sklearn, scipy ... ) 的时候总是出现这个问题,明明已经安装了 openblas (没有安装的朋友 `brew install openblas` 安装), 但就是找不到。

Run-time dependency openblas found: NO (tried pkgconfig, framework and cmake)
            Run-time dependency openblas found: NO (tried pkgconfig, framework and cmake)

            ../../scipy/meson.build:134:0: ERROR: Dependency "OpenBLAS" not found, tried pkgconfig, framework and cmake

            A full log can be found at /private/var/folders/mj/c_b9lkvn6x522_0zk2bl8t640000gp/T/pip-install-ylvj3qnf/scipy_473d2ef11643463eb16bc8ff3a65307c/.mesonpy-lmi4u5p2/build/meson-logs/meson-log.txt
            + meson setup --prefix=/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.8 /private/var/folders/mj/c_b9lkvn6x522_0zk2bl8t640000gp/T/pip-install-ylvj3qnf/scipy_473d2ef11643463eb16bc8ff3a65307c /private/var/folders/mj/c_b9lkvn6x522_0zk2bl8t640000gp/T/pip-install-ylvj3qnf/scipy_473d2ef11643463eb16bc8ff3a65307c/.mesonpy-lmi4u5p2/build --native-file=/private/var/folders/mj/c_b9lkvn6x522_0zk2bl8t640000gp/T/pip-install-ylvj3qnf/scipy_473d2ef11643463eb16bc8ff3a65307c/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
            [end of output]

        note: This error originates from a subprocess, and is likely not a problem with pip.
      error: metadata-generation-failed

      × Encountered error while generating package metadata.
      ╰─> See above for output.

      note: This is an issue with the package mentioned above, not pip.
      hint: See above for details.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

大多数时候可以使用 conda解决。

conda install --channel=conda-forge your_package

安装sklearn时conda 不管用了,最终使用以下语句解决

export PKG_CONFIG_PATH="/opt/homebrew/opt/openblas/lib/pkgconfig"
export LDFLAGS="-L/opt/homebrew/opt/openblas/lib"  
export CPPFLAGS="-I/opt/homebrew/opt/openblas/include"

Ref: https://github.com/pyenv/pyenv/issues/2394

 类似资料: