当前位置:   article > 正文

python版本原因导致的grpcio-tools-1.48.2安装失败_grpcio安装失败

grpcio安装失败

因为工作需要使用python开发grpc客户端,在mac电脑上通以下命令安装python的grpc依赖库总是不成功

pip3 install --no-cache-dir  --force-reinstall -Iv grpcio==1.48.2 grpcio-tools==1.48.2

  1. clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DHAVE_PTHREAD=1 -I. -Igrpc_root -Igrpc_root/include -Ithird_party/protobuf/src -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c third_party/protobuf/src/google/protobuf/util/time_util.cc -o build/temp.macosx-10.10-universal2-cpython-311/third_party/protobuf/src/google/protobuf/util/time_util.o -std=c++14 -fno-wrapv -frtti
  2. third_party/protobuf/src/google/protobuf/util/internal/protostream_objectwriter.cc:380:21: warning: comparison of integers of different signs: 'int' and 'std::vector<google::protobuf::util::converter::ProtoStreamObjectWriter::AnyWriter::Event>::size_type' (aka 'unsigned long') [-Wsign-compare]
  3. for (int i = 0; i < uninterpreted_events_.size(); ++i) {
  4. ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. 1 warning generated.
  6. clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch arm64 -arch x86_64 -g -DHAVE_PTHREAD=1 -I. -Igrpc_root -Igrpc_root/include -Ithird_party/protobuf/src -I/Library/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c third_party/protobuf/src/google/protobuf/util/type_resolver_util.cc -o build/temp.macosx-10.10-universal2-cpython-311/third_party/protobuf/src/google/protobuf/util/type_resolver_util.o -std=c++14 -fno-wrapv -frtti
  7. error: command '/usr/bin/clang' failed with exit code 1
  8. error: subprocess-exited-with-error
  9. × Building wheel for grpcio-tools (pyproject.toml) did not run successfully.
  10. exit code: 1
  11. ╰─> See above for output.
  12. note: This error originates from a subprocess, and is likely not a problem with pip.
  13. full command: /Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11 /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /var/folders/ww/0rqb_9h96wz5t4n4wws3bkv40000gn/T/tmpzmc5aqew
  14. cwd: /private/var/folders/ww/0rqb_9h96wz5t4n4wws3bkv40000gn/T/pip-install-klp2us5i/grpcio-tools_d9c3a230080c45098badecabfb5d066d
  15. Building wheel for grpcio-tools (pyproject.toml) ... error
  16. ERROR: Failed building wheel for grpcio-tools
  17. Failed to build grpcio grpcio-tools
  18. ERROR: Could not build wheels for grpcio, grpcio-tools, which is required to install pyproject.toml-based projects

以为是pip源的问题,后来尝试下载whl文件本地安装, 但是提示

  1. # pip3 install grpcio-1.48.2-cp310-cp310-macosx_10_10_x86_64.whl
  2. Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
  3. ERROR: grpcio-1.48.2-cp310-cp310-macosx_10_10_x86_64.whl is not a supported wheel on this platform.

由此想到本地安装的是python311, 而whl下载的都是cp310,cp39 (项目组使用的protobuf是3.19.4,对应grepio版本最高时1.48.2版本,所有最高只能支持到cp310), 

于是通过 % python3 -m pip debug --verbose 命令查看支持的版本,果然都是cp311

至此定位,就是版本不匹配。 果断换成python310后,问题解决

  1. % pip3 install grpcio==1.48.2 grpcio-tools==1.48.2
  2. Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
  3. Collecting grpcio==1.48.2
  4. Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d8/86/e474e8e6979a7919bfec5906c7d76816904cc78f9b12f0d1abfee618b50e/grpcio-1.48.2-cp310-cp310-macosx_10_10_x86_64.whl (4.2 MB)
  5. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 15.6 MB/s eta 0:00:00
  6. Collecting grpcio-tools==1.48.2
  7. Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d1/1e/7700466b6f85ade8f3bcb8975d5fe309a7f06ef5a49c00fa28f58e0edfdf/grpcio_tools-1.48.2-cp310-cp310-macosx_10_10_x86_64.whl (2.1 MB)
  8. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 11.1 MB/s eta 0:00:00
  9. Collecting six>=1.5.2 (from grpcio==1.48.2)
  10. Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB)
  11. Requirement already satisfied: protobuf<4.0dev,>=3.12.0 in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from grpcio-tools==1.48.2) (3.19.4)
  12. Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from grpcio-tools==1.48.2) (69.1.1)
  13. Installing collected packages: six, grpcio, grpcio-tools
  14. Successfully installed grpcio-1.48.2 grpcio-tools-1.48.2 six-1.16.0

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小舞很执着/article/detail/956835
推荐阅读
相关标签
  

闽ICP备14008679号