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

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

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

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
  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]
    for (int i = 0; i < uninterpreted_events_.size(); ++i) {
                    ~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 warning generated.
  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
  error: command '/usr/bin/clang' failed with exit code 1
  error: subprocess-exited-with-error

  × Building wheel for grpcio-tools (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> See above for output.

  note: This error originates from a subprocess, and is likely not a problem with pip.
  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
  cwd: /private/var/folders/ww/0rqb_9h96wz5t4n4wws3bkv40000gn/T/pip-install-klp2us5i/grpcio-tools_d9c3a230080c45098badecabfb5d066d
  Building wheel for grpcio-tools (pyproject.toml) ... error
  ERROR: Failed building wheel for grpcio-tools
Failed to build grpcio grpcio-tools
ERROR: Could not build wheels for grpcio, grpcio-tools, which is required to install pyproject.toml-based projects

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

# pip3 install grpcio-1.48.2-cp310-cp310-macosx_10_10_x86_64.whl
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
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后,问题解决

% pip3 install grpcio==1.48.2 grpcio-tools==1.48.2
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting grpcio==1.48.2
  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)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.2/4.2 MB 15.6 MB/s eta 0:00:00
Collecting grpcio-tools==1.48.2
  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)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 11.1 MB/s eta 0:00:00
Collecting six>=1.5.2 (from grpcio==1.48.2)
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl (11 kB)
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)
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)
Installing collected packages: six, grpcio, grpcio-tools
Successfully installed grpcio-1.48.2 grpcio-tools-1.48.2 six-1.16.0

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
引用和中的错误信息提示了无法构建某个包的wheels,而这个包是安装pyproject.toml-based项目所需要的包。具体来说,引用中的错误是关于cryptography包的,引用中的错误是关于lanms-neo包的。 根据这些错误信息,可以推测您在尝试安装grpcio包时遇到了类似的问题。具体地说,错误提示为"ERROR: Could not build wheels for grpcio, which is required to install pyproject.toml-based projects"。这表明在构建grpcio包的wheels时出现了问题。 解决这种问题的方法可以有多种。首先,您可以尝试更新所需包的版本。可能存在一些已知的问题或依赖项不兼容,通过使用最新版本可能会解决这些问题。 另外,您还可以检查您的开发环境是否缺少必要的依赖项。例如,在Windows系统上,可能需要安装Microsoft Visual C++ 14.0或更高版本的组件。 此外,您还可以尝试查找与该错误相关的解决方案。您可以搜索类似的错误信息或查看相关的开发者论坛或社区,看看其他人是否遇到了类似的问题,并找到了解决方案。 最后,如果尝试了这些解决方法后问题仍然存在,您可能需要考虑与包的开发者或维护者联系,寻求他们的帮助或报告该问题。他们可能能够提供更具体的解决方案或修复错误的版本。 总结起来,解决"ERROR: Could not build wheels for grpcio, which is required to install pyproject.toml-based projects"的方法包括更新包的版本安装必要的依赖项、搜索相关解决方案以及联系包的开发者或维护者。希望这些方法能够帮助您解决问题。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值