1

This has been a long fight trying to install tensorflow in Mac Mini M1... I'm using macOS Monterey(12.0 Beta) According to the last instructions from tensorflow/apple (https://developer.apple.com/metal/tensorflow-plugin/), I'm using miniforge conda, create a blank environment and then do the following:

conda install -c apple tensorflow-deps

Everything goes ok but then when I do the next step everything breaks:

python -m pip install tensorflow-macos
  • Tried with python3.8 with the following error (summary, not the full logs):

     distutils.errors.CompileError: command 'gcc' failed with exit status 1
    
    ----------------------------------------
    ERROR: Failed building wheel for grpcio
    
  • Tried with python3.9 with the following error (summary, not the full logs):

      distutils.errors.CompileError: command '/usr/bin/clang' failed with exit code 1
    
    ----------------------------------------
    ERROR: Failed building wheel for grpcio
    
  • Tried with force reinstall and no-cache-dir (python -m pip install tensorflow-macos --no-cache-dir --force-reinstall) with the following error :

    ERROR: Command errored out with exit status 1: /Users/machine/miniforge3/envs/tf38/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-djre1j5j/numpy_48546adcbc9d4c558a4dc32a8e607649/setup.py'"'"'; file='"'"'/private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-install-djre1j5j/numpy_48546adcbc9d4c558a4dc32a8e607649/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-record-343ln54c/install-record.txt --single-version-externally-managed --prefix /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-build-env-1fyu7c9t/normal --compile --install-headers /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-build-env-1fyu7c9t/normal/include/python3.8/numpy Check the logs for full command output. ---------------------------------------- WARNING: Discarding https://files.pythonhosted.org/packages/a7/81/20d5d994c91ed8347efda90d32c396ea28254fd8eb9e071e28ee5700ffd5/h5py-3.1.0.tar.gz#sha256=1e2516f190652beedcb8c7acfa1c6fa92d99b42331cbef5e5c7ec2d65b0fc3c2 (from https://pypi.org/simple/h5py/) (requires-python:>=3.6). Command errored out with exit status 1: /Users/machine/miniforge3/envs/tf38/bin/python /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-standalone-pip-nmsgrvml/env_pip.zip/pip install --ignore-installed --no-user --prefix /private/var/folders/0k/hz9yngm56nz1htdc3c3t3d0c0000gn/T/pip-build-env-1fyu7c9t/normal --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'numpy==1.12; python_version == "3.6"' 'Cython>=0.29; python_version < "3.8"' 'numpy==1.14.5; python_version == "3.7"' 'numpy==1.19.3; python_version >= "3.9"' 'numpy==1.17.5; python_version == "3.8"' pkgconfig 'Cython>=0.29.14; python_version >= "3.8"' Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement h5py~=3.1.0 (from tensorflow-macos) (from versions: 2.2.1, 2.3.0b1, 2.3.0, 2.3.1, 2.4.0b1, 2.4.0, 2.5.0, 2.6.0, 2.7.0rc2, 2.7.0, 2.7.1, 2.8.0rc1, 2.8.0, 2.9.0rc1, 2.9.0, 2.10.0, 3.0.0rc1, 3.0.0, 3.1.0, 3.2.0, 3.2.1, 3.3.0, 3.4.0) ERROR: No matching distribution found for h5py~=3.1.0

MrT77
  • 811
  • 6
  • 25

2 Answers2

0

I am fighting with M1 Mac Pro but on Big Sur. What worked for me - make sure you are working with arm64 terminal environment and that you have installed Homebrew for it. Then just run:

brew install gcc

After you restart the terminal (just in case) aka closing it and opening a new one, should be installed without a problem.

Adriyana
  • 1
  • 2
0

Try running the following code line

SYSTEM_VERSION_COMPAT=0 python -m pip install tensorflow-macos

For a short tutorial on installation refer this