18 Steps to install tensorflow_macos on the M1 MacBook (2020)

If your installation process of tensorflow_macos has been like mine, first off, I’m sorry. Second off, there is some great news! I have put together steps that led to my successful installation below. I need to credit a GitHub thread where some of the steps below come from here.

Also, if you haven’t already, I have made a YouTube video that details this install process here.

  1. Install miniforge3: https://github.com/conda-forge/miniforge/#download
    1. Apple Silicon link
  2. Restart terminal so that Conda is recognized
    1. Type Conda in prompt to check
  3. Create Conda environment with python3.8 since python3.9 is the default from Miniforge (user python38 for your name): conda create β€”name python38-demo-v2 python=3.8
  4. Activate virtual environment: conda activate <env_name>
  5. Download the zipped tar file from apple/tensorflow_macos
    1. https://github.com/apple/tensorflow_macos/releases
  6. Unzip the tar file
    1. Navigate to Downloads
    2. Tar -xvf <filename>
  7. Get the working directory of arm64 within that folder
    1. Once there, type: pwd
    2. Set variables
      1. libs=location of arm64 above
        1. libs=β€œ/Users/nick/Downloads/tensorflow_macos/arm64/β€œ
      2. env=location of your python virtual environment
        1. env=β€œ/Users/nick/miniforge3/envs/<env_name>
  8. Conda install cached-property
  9. Conda install six
  10. 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”
  11. 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”
  12. 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”
  13. 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

14. pip install wrapt flatbuffers tensorflow_estimator google_pasta keras_preprocessing protobuf

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

Make sure this is pointing to the right version within your downloads folder

16. pip install tensorboard

17. type python into the command prompt to open a python shell

18. import tensorflow

If you completed the last step successfully with no errors, you are all set! Happy Deep Learning πŸ™‚

 

Show More

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button