error:fail of building wheel for grpcio

I follow the step of installing tensorflow on MacBook Pro M1. https://developer.apple.com/metal/tensorflow-plugin/ When i install the base tensorflow, it keep on showing the error: fail of building wheel for grpcio. I has updated my setuptools, pip, and grpcio to the latest version but it still not work. My python version is 3.9.6. How can i install tensorflow successfully?

Accepted Answer

Hi frankiexe, We recently updated the tensorflow-deps to a more recent version. That might have led to version mismatch. Can you try following steps and if it helps ?

conda uninstall -c apple tensorflow-deps
conda install -c apple tensorflow-deps==2.5.0

Hi Frankie.

I've ran into the same error. grpcio needs some environment variables to be correctly compiled.

add those two lines at the end of your .zshrc file

export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
export GRPC_PYTHON_BUILD_SYSTEM_ZLIB=1

Also close/open your terminal app so it will apply the variables at opening the terminal.

error:fail of building wheel for grpcio
 
 
Q