Mac M1 NumPy 설치 오류

created Apr 21, 2023 | updated Apr 21, 2023

Mac M1에서 numpy 설치하는데 오류가 발생했다.

MacOS의 built-in BLAS이 numpy가 어울리지 않기 때문에 다른 BLAS 라이브러리로 대체해야 한다. openblas으로 BLAS 라이브러리를 대체하자.

오류 내용


❯ pip install numpy
...
      clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
      clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
      clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
      clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
      clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
      clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
      clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
      clang: error: the clang compiler does not support 'faltivec', please use -maltivec and include altivec.h explicitly
      Running from numpy source directory.
      /private/var/folders/v8/ntfqm0zn0m917b3z_b5g91_00000gp/T/pip-build-env-s3b5ac_2/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py:265: UserWarning: Unknown distribution option: 'define_macros'
        warnings.warn(msg)
      error: Command "clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -DOPENSSL_NO_SSL3 -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/opt/homebrew/opt/openssl@3/include -I/opt/homebrew/opt/mysql-client/include -DNPY_INTERNAL_BUILD=1 -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-13.2-arm64-3.8/numpy/core/src/umath -Ibuild/src.macosx-13.2-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-13.2-arm64-3.8/numpy/core/src/common -Inumpy/core/include -Ibuild/src.macosx-13.2-arm64-3.8/numpy/core/include/numpy -Inumpy/core/src/common -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Users/lou/.pyenv/versions/3.8.13/include/python3.8 -Ibuild/src.macosx-13.2-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-13.2-arm64-3.8/numpy/core/src/npymath -Ibuild/src.macosx-13.2-arm64-3.8/numpy/core/src/common -Ibuild/src.macosx-13.2-arm64-3.8/numpy/core/src/npymath -c numpy/core/src/multiarray/buffer.c -o build/temp.macosx-13.2-arm64-cpython-38/numpy/core/src/multiarray/buffer.o -MMD -MF build/temp.macosx-13.2-arm64-cpython-38/numpy/core/src/multiarray/buffer.o.d -faltivec -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects
[end of output]
...

해결


# openblas 설치
brew install openblas
OPENBLAS="$(brew --prefix openblas)" pip install numpy

참고


※ 이 포스팅은 쿠팡 파트너스 활동의 일환으로, 이에 따른 일정액의 수수료를 제공받습니다.

유리아쥬 제모스 스틱 레브르 립밤 4g x 10개, 12개, 무향솔가 어드밴스드 칼슘 컴플렉스 타블렛, 120개입, 1개커세어 코리아 정품 DARK CORE PRO 무선 충전 RGB 게이밍 마우스 / 다용도 에코백 사은품 증정, 혼합색상, RGP0076