简体   繁体   English

Grpcio 在 arm64 Apple Silicon 上安装 Tensorflow 2.5 失败

[英]Grpcio fails installation for Tensorflow 2.5 on arm64 Apple Silicon

I'm following the instructions here: https://developer.apple.com/metal/tensorflow-plugin/ and having issues installing grpcio.我按照此处的说明进行操作: https://developer.apple.com/metal/tensorflow-plugin/并且在安装 grpcio 时遇到问题。 When I try python -m pip install tensorflow-macos I get:当我尝试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

The subsequent attempt also ends in an error:随后的尝试也以错误结束:

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

The solutions given here: How can I install GRPCIO on an Apple M1 Silicon laptop?此处给出的解决方案: How can I install GRPCIO on an Apple M1 Silicon laptop? have unfortunately not worked to me.不幸的是对我没有用。

I am quite inexperienced with architecture/chip challenges, but it reads that the arm64 is currently not supported?我对架构/芯片挑战没有经验,但它显示当前不支持 arm64? If that is the case it is odd that it is included in the tensorflow_plugin steps.如果是这种情况,那么奇怪的是它包含在 tensorflow_plugin 步骤中。 Any thoughts on what I am doing wrong would be appreciated.对我做错了什么的任何想法将不胜感激。

What helped me was:对我有帮助的是:

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

I had to我不得不

  1. Build boringssl manually ( github answer )手动构建boringsslgithub 回答
  2. Use the flags while installing grpcio as explained in the previous answer如上一个答案中所述,在安装grpcio时使用标志
  3. Upgrade numpy ( TypeError StackOverflow )升级 numpy( TypeError StackOverflow

Install安装

# 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

Test测试

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在具有 M1 芯片(基于 ARM 的 Apple Silicon)的 Mac 上安装早期版本的 Python(3.8 之前)失败 - Installation of earlier versions of Python (prior to 3.8) fails on Mac with M1 Chip (ARM based Apple Silicon) 无法在 Apple M1 芯片上安装 google-cloud-aiplatform - 在 grpcio 上失败 - Can't install google-cloud-aiplatform on Apple M1 silicon - Fails on grpcio 如何在M1(Apple Silicon / Darwin-arm64)上安装和导入Scipy、Numpy、NumExpr等? - How to install and import Scipy, Numpy, NumExpr and others on M1 (Apple Silicon / Darwin-arm64)? 错误:Apple Arm64 ABI 需要 ffi_prep_cif_var - error: Apple Arm64 ABI requires ffi_prep_cif_var Buildozer 无法在 arm64/aarch64 CPU 上编译 libffi - Buildozer fails to compile libffi on arm64/aarch64 CPU Apple Silicon M1 上的 Python Tensorflow 和 OpenCV - Python Tensorflow and OpenCV on Apple Silicon M1 python Apple 错误 TensorFlow on M1 (apple silicon) - python errors in Apple TensorFlow on M1 (apple silicon) 为 arm64 架构编译 python 模块 - Compile python modules for arm64 architecture 将此 ARM64 程序集转换为 Python? - Converting this ARM64 Assembly into Python? 如何在 Apple Silicon (ARM / M1) 上安装 SciPy - How to install SciPy on Apple Silicon (ARM / M1)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM