ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • M1 mac(11.5.x) 에서 tensorflow2.5 설치
    Deep Learning 2021. 8. 10. 22:49

    M1 mac에서 tensorflow를 설치하려고 하니 스트레스가 이만저만이 아니였다.

    구글링을 통해서 찾아본 M1 mac tensorlfow 설치는 대부분 11.2version에서 호환 하는 듯 했고, 

    나는 'error: tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl is not a supported wheel on this platform.'라는 에러가 발생하면서 되지 않았다. 처음엔 anaconda가 문제인줄 알고 삭제 했다가 miniforge로 재설치하여도 같은 문제가 발생하였고, 포기하던 찰나에 성공하였다.

     

    순서는 아래의 4가지로 정리할 수 있다.

     

    1. miniforge 설치

    - anaconda를 사용해서는 안되고, miniforge를 활용해야 m1 mac에서 tensorflow를 사용할 수 있다고 하니, 기존에 anaconda를 활용하고 있었다면, 삭제 해주고 miniforge를 설치하자. 

     

     

    * 아나콘다 삭제 방법

    step 1

    conda install anaconda-clean
    anaconda-clean --yes

    step 2 : 아나콘다를 설치한 폴더 전체를 제거한다.

    rm -rf ~/anaconda3

     

    * miniforge 설치방법

     

    Option 1

     

    step 1 : homebrew가 없으면 설치

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

    step 2

    brew install miniforge

    step 3 : 터미널 환경에 맞게 실행, 모른다면 둘다 실행해도 무관

    conda init bash
    conda init zsh

     

     

    Option 2 : (확인 된 방법 아님)

    chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh
    sh ~/Downloads/Miniforge3-MacOSX-arm64.sh
    source ~/miniforge3/bin/activate

     

    2. 가상환경 생성 (python version 3.8.x)

    conda create --name tf25 python==3.8.2
    conda activate tf25

    3. tensorflow-macos 설치

    python -m pip install tensorflow-macos

     

    나는 3번 tensorflow-macos 설치과정에서 'ERROR: Failed building wheel for grpcio'를 만났는데 아래의 두줄을 통해 해결했다.

    pip3 install --upgrade pip
    python3 -m pip install --upgrade setuptools

     

    4. tensorflow-metal 설치

    python -m pip install tensorflow-metal

     

     

    출처 

    https://stackoverflow.com/questions/56357794/unable-to-install-grpcio-using-pip-install-grpcio

    https://developer.apple.com/metal/tensorflow-plugin/

Designed by Tistory.