Grpcio не удается установить для Tensorflow 2.5 на arm64 Apple Silicon

Я следую инструкциям здесь: https://developer.apple.com/metal/tensorflow-plugin/, и у меня проблемы с установкой grpcio. Когда я пытаюсь python -m pip install tensorflow-macos Я получил:

        AssertionError: would build wheel with unsupported tag ('cp39', 'cp39', 'macosx_11_0_arm64')
  ----------------------------------------
  ERROR: Failed building wheel for grpcio

Последующая попытка также заканчивается ошибкой:

      Running setup.py clean for grpcio
Failed to build grpcio
Installing collected packages: grpcio, tensorflow-estimator, keras-nightly, flatbuffers
  Attempting uninstall: grpcio
    Found existing installation: grpcio 1.38.1
    Uninstalling grpcio-1.38.1:
      Successfully uninstalled grpcio-1.38.1
    Running setup.py install for grpcio ... error

Приведенные здесь решения: Как установить GRPCIO на ноутбук Apple M1 Silicon?к сожалению, мне не помогли.

Я совершенно не разбираюсь в проблемах архитектуры / чипа, но он пишет, что arm64 в настоящее время не поддерживается? Если это так, то странно, что он включен в шаги tensorflow_plugin. Будем признательны за любые мысли о том, что я делаю неправильно.

3 ответа

Мне помогли:

      GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1  python -m pip install tensorflow-macos

Мне пришлось

  1. Строитьboringsslвручную ( ответ github )
  2. Используйте флаги при установкеgrpcioкак описано в предыдущем ответе
  3. Обновить numpy ( TypeError StackOverflow)

Установить

      # The following are required to locally build boringssl
brew install go
brew install wget
brew install cmake
mkdir boringssl
cd boringssl
wget https://boringssl.googlesource.com/boringssl/+archive/master.tar.gz
gunzip -c master.tar.gz | tar xopf -
mkdir build
cd build
cmake ..
make

# Install `grpcio` with the right 
YCFLAGS="-I /opt/homebrew/opt/openssl/include" LDFLAGS="-L /opt/homebrew/opt/openssl/lib" GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1 GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1 pip install 'grpcio'
pip install tensorflow-macos

# If you see an error like below then upgrade numpy
#
# TypeError: Unable to convert function return value to a Python type! The signature was () -> handle
pip install numpy --upgrade

Тест

      python -c "import tensorflow as tf; print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

Мне удалось установить Tensorflow 2.5, используя библиотеки metal и mac_os, следуя этим инструкциям: https://medium.com/@theDrewDag/how-to-install-tensorflow-2-5-on-apple-m1-7c42cf51af95

Делитесь, если это помогает другим.

Другие вопросы по тегам