安装 grpcio 时出现 DeprecationWarning 错误:pkg_resources

问题描述 投票:0回答:1

我安装了 python 3.12,1 并在 venv 中工作

pip 为 23.3.2 setuptools 的版本为 69.0.3

安装 grpcio-1.57.0 时失败。输出如下所示。任何帮助将不胜感激!

pip wheel --no-cache-dir --use-pep517 "grpcio (==1.57.0)"
Collecting grpcio==1.57.0
  Downloading grpcio-1.57.0.tar.gz (24.7 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 24.7/24.7 MB 110.8 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      <string>:43: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      Traceback (most recent call last):
        File "/home/richard/headcoach/headCoach-backend/backend-1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/richard/headcoach/headCoach-backend/backend-1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/richard/headcoach/headCoach-backend/backend-1/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6dp2h0u2/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-6dp2h0u2/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-6dp2h0u2/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-6dp2h0u2/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 292, in <module>
        File "<string>", line 226, in check_linker_need_libatomic
        File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/usr/lib/python3.12/subprocess.py", line 1950, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: 'c++'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel 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.

我已经用谷歌搜索了这个问题,根据一些来源,我正在使用的 pip 和 setuptools 版本不会出现这种情况。

python-3.x pip setuptools grpcio
1个回答
0
投票

您尝试安装的版本grpcio 1.57.0不支持python 3.12.1。您可以安装支持 python 3.12 的稳定版本 (grpcio 1.60.0) 或将 python 版本降级到 3.11 以使用旧版本。

© www.soinside.com 2019 - 2024. All rights reserved.