Apple M1で機械学習環境を構築する

  1. Download the archive for this repo from https://github.com/apple/tensorflow_macos/releases
  2. I downloaded Miniconda from https://conda-forge.org/blog/posts/2020-10-29-macos-arm64/
  3. Install Miniconda
  4. Once it’s installed, create a Python 3.8 env by running conda create --name python38 python=3.8
  5. Because it’s a new env, there’s no way you have any packages like Tensorflow on there already (good) so…
  6. Run this script:

# Put a path to where the arm64 libraries are. For example…
libs=”/Users//tensorflow_macos/arm64/”

# Replace this with the path of your Conda environment
env=”/Users//miniforge3/envs/python38″

# The rest should work
conda upgrade -c conda-forge pip setuptools cached-property six

pip install –upgrade -t “$env/lib/python3.8/site-packages/” –no-dependencies –force “$libs/grpcio-1.33.2-cp38-cp38-macosx_11_0_arm64.whl”

pip install –upgrade -t “$env/lib/python3.8/site-packages/” –no-dependencies –force “$libs/h5py-2.10.0-cp38-cp38-macosx_11_0_arm64.whl”

# pip install –upgrade -t “$env/lib/python3.8/site-packages/” –no-dependencies –force “$libs/numpy-1.18.5-cp38-cp38-macosx_11_0_arm64.whl”

pip install –upgrade -t “$env/lib/python3.8/site-packages/” –no-dependencies –force “$libs/tensorflow_addons-0.11.2+mlcompute-cp38-cp38-macosx_11_0_arm64.whl”

conda install -c conda-forge -y absl-py
conda install -c conda-forge -y astunparse
conda install -c conda-forge -y gast
conda install -c conda-forge -y opt_einsum
conda install -c conda-forge -y termcolor
conda install -c conda-forge -y typing_extensions
conda install -c conda-forge -y wheel
conda install -c conda-forge -y typeguard
conda install -c conda-forge -y grpcio

pip install tensorboard

pip install wrapt flatbuffers tensorflow_estimator google_pasta keras_preprocessing protobuf

pip install –upgrade -t “$env/lib/python3.8/site-packages/” –no-dependencies –force “$libs/tensorflow_macos-0.1a0-cp38-cp38-macosx_11_0_arm64.whl”

https://github.com/apple/tensorflow_macos/issues/3 より引用、一部改変

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です