簡體   English   中英

Grpcio 在 arm64 Apple Silicon 上安裝 Tensorflow 2.5 失敗

[英]Grpcio fails installation for Tensorflow 2.5 on 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

此處給出的解決方案: How can I install GRPCIO on an Apple M1 Silicon laptop? 不幸的是對我沒有用。

我對架構/芯片挑戰沒有經驗,但它顯示當前不支持 arm64? 如果是這種情況,那么奇怪的是它包含在 tensorflow_plugin 步驟中。 對我做錯了什么的任何想法將不勝感激。

對我有幫助的是:

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

我不得不

  1. 手動構建boringsslgithub 回答
  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])))"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM