无法构建 grpcio grpcio-tools,无法为某些基于 pyproject.toml 的项目(grpcio、grpcio-tools)构建可安装的轮子

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

手动运行

pip install grpcio
pip install grpcio-tools
成功。 但是,运行“pip install -rrequirements.txt”,其中
requirements.txt

grpcio==1.62.2
grpcio-tools==1.62.2

给出以下错误(完整的错误太长,我只附上底部部分):

      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD "-IC:\Users\AI Internist\AppData\Local\Programs\Python\Python313\include" "-IC:\Users\AI Internist\AppData\Local\Programs\Python\Python313\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /TcC:\Users\AIINTE~1\AppData\Local\Temp\tmp12fy4pjb\a.c /Fo\Users\AIINTE~1\AppData\Local\Temp\tmp12fy4pjb\a.obj
      a.c
      Traceback (most recent call last):
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\spawn.py", line 70, in spawn
          subprocess.check_call(cmd, env=_inject_macos_ver(env))
          ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 419, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\cl.exe', '/c', '/nologo', '/O2', '/W3', '/GL', '/DNDEBUG', '/MD', '-D_WIN32_WINNT=1536', '-DGRPC_XDS_USER_AGENT_NAME_SUFFIX="\\"Python\\""', '-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX="\\"1.62.2\\""', '-DOPENSSL_NO_ASM=1', '-DWIN32_LEAN_AND_MEAN=1', '-DCARES_STATICLIB=1', '-DGRPC_ARES=0', '-DNTDDI_VERSION=100663296', '-DNOMINMAX=1', '-DMS_WIN64=1', '-DGRPC_DO_NOT_INSTANTIATE_POSIX_POLLER=1', '-D__STDC_FORMAT_MACROS', '-Isrc\\python\\grpcio', '-Iinclude', '-I.', '-Ithird_party\\abseil-cpp', '-Ithird_party\\address_sorting\\include', '-Ithird_party\\cares\\cares\\include', '-Ithird_party\\cares', '-Ithird_party\\cares\\cares', '-Ithird_party\\re2', '-Ithird_party\\boringssl-with-bazel\\src\\include', '-Ithird_party\\upb', '-Isrc\\core\\ext\\upb-gen', '-Isrc\\core\\ext\\upbdefs-gen', '-Ithird_party\\utf8_range', '-Ithird_party\\xxhash', '-Ithird_party\\zlib', '-IC:\\Users\\AI Internist\\AppData\\Local\\Programs\\Python\\Python313\\include', '-IC:\\Users\\AI Internist\\AppData\\Local\\Programs\\Python\\Python313\\Include', '-IC:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\include', '-IC:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\ATLMFC\\include', '-IC:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\VS\\include', '-IC:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.22621.0\\ucrt', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\um', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\shared', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\winrt', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\cppwinrt', '/EHsc', '/Tcsrc/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c', '/Fopyb\\temp.win-amd64-cpython-313\\Release\\src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.obj', '/std:c11', '/MT']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 455, in compile
          self.spawn(args)
          ~~~~~~~~~~^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 553, in spawn
          return super().spawn(cmd, env=env)
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-install-ux0bxp6b\grpcio_1c3f47c8b7304b1ab2167cd92f78c99e\src\python\grpcio\_spawn_patch.py", line 58, in _commandfile_spawn
          _classic_spawn(self, command, **kwargs)
          ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\ccompiler.py", line 1045, in spawn
          spawn(cmd, dry_run=self.dry_run, **kwargs)
          ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\spawn.py", line 76, in spawn
          raise DistutilsExecError(
              f"command {_debug(cmd)!r} failed with exit code {err.returncode}"
          ) from err
      distutils.errors.DistutilsExecError: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\cl.exe' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-install-ux0bxp6b\grpcio_1c3f47c8b7304b1ab2167cd92f78c99e\src\python\grpcio\commands.py", line 313, in build_extensions
          build_ext.build_ext.build_extensions(self)
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 476, in build_extensions
          self._build_extensions_serial()
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 502, in _build_extensions_serial
          self.build_extension(ext)
          ~~~~~~~~~~~~~~~~~~~~^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 264, in build_extension
          _build_ext.build_extension(self, ext)
          ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 557, in build_extension
          objects = self.compiler.compile(
              sources,
          ...<5 lines>...
              depends=ext.depends,
          )
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 457, in compile
          raise CompileError(msg)
      distutils.errors.CompileError: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\cl.exe' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
          ~~~~^^
        File "C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                              metadata_directory)
                                              ^^^^^^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\build_meta.py", line 438, in build_wheel
          return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)])
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\build_meta.py", line 426, in _build
          return self._build_with_temp_dir(
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^
              cmd,
              ^^^^
          ...<3 lines>...
              self._arbitrary_args(config_settings),
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          )
          ^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\build_meta.py", line 407, in _build_with_temp_dir
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\build_meta.py", line 522, in run_setup
          super().run_setup(setup_script=setup_script)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
.
.
.
.
.
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\spawn.py", line 70, in spawn
          subprocess.check_call(cmd, env=_inject_macos_ver(env))
          ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 419, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\cl.exe', '/c', '/nologo', '/O2', '/W3', '/GL', '/DNDEBUG', '/MD', '-D_WIN32_WINNT=1536', '-DGRPC_XDS_USER_AGENT_NAME_SUFFIX="\\"Python\\""', '-DGRPC_XDS_USER_AGENT_VERSION_SUFFIX="\\"1.62.2\\""', '-DOPENSSL_NO_ASM=1', '-DWIN32_LEAN_AND_MEAN=1', '-DCARES_STATICLIB=1', '-DGRPC_ARES=0', '-DNTDDI_VERSION=100663296', '-DNOMINMAX=1', '-DMS_WIN64=1', '-DGRPC_DO_NOT_INSTANTIATE_POSIX_POLLER=1', '-D__STDC_FORMAT_MACROS', '-Isrc\\python\\grpcio', '-Iinclude', '-I.', '-Ithird_party\\abseil-cpp', '-Ithird_party\\address_sorting\\include', '-Ithird_party\\cares\\cares\\include', '-Ithird_party\\cares', '-Ithird_party\\cares\\cares', '-Ithird_party\\re2', '-Ithird_party\\boringssl-with-bazel\\src\\include', '-Ithird_party\\upb', '-Isrc\\core\\ext\\upb-gen', '-Isrc\\core\\ext\\upbdefs-gen', '-Ithird_party\\utf8_range', '-Ithird_party\\xxhash', '-Ithird_party\\zlib', '-IC:\\Users\\AI Internist\\AppData\\Local\\Programs\\Python\\Python313\\include', '-IC:\\Users\\AI Internist\\AppData\\Local\\Programs\\Python\\Python313\\Include', '-IC:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\include', '-IC:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\ATLMFC\\include', '-IC:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\VS\\include', '-IC:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.22621.0\\ucrt', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\um', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\shared', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\winrt', '-IC:\\Program Files (x86)\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\cppwinrt', '/EHsc', '/Tcsrc/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c', '/Fopyb\\temp.win-amd64-cpython-313\\Release\\src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.obj', '/std:c11', '/MT']' returned non-zero exit status 1.

      The above exception was the direct cause of the following exception:

      Traceback (most recent call last):
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 455, in compile
          self.spawn(args)
          ~~~~~~~~~~^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 553, in spawn
          return super().spawn(cmd, env=env)
                 ~~~~~~~~~~~~~^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-install-ux0bxp6b\grpcio_1c3f47c8b7304b1ab2167cd92f78c99e\src\python\grpcio\_spawn_patch.py", line 58, in _commandfile_spawn
          _classic_spawn(self, command, **kwargs)
          ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\ccompiler.py", line 1045, in spawn
          spawn(cmd, dry_run=self.dry_run, **kwargs)
          ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\spawn.py", line 76, in spawn
          raise DistutilsExecError(
              f"command {_debug(cmd)!r} failed with exit code {err.returncode}"
          ) from err
      distutils.errors.DistutilsExecError: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\cl.exe' failed with exit code 1

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-install-ux0bxp6b\grpcio_1c3f47c8b7304b1ab2167cd92f78c99e\src\python\grpcio\commands.py", line 313, in build_extensions
          build_ext.build_ext.build_extensions(self)
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 476, in build_extensions
          self._build_extensions_serial()
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 502, in _build_extensions_serial
          self.build_extension(ext)
          ~~~~~~~~~~~~~~~~~~~~^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 264, in build_extension
          _build_ext.build_extension(self, ext)
          ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 557, in build_extension
          objects = self.compiler.compile(
              sources,
          ...<5 lines>...
              depends=ext.depends,
          )
        File "C:\Users\AI Internist\AppData\Local\Temp\pip-build-env-11929ne3\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 457, in compile
          raise CompileError(msg)
      distutils.errors.CompileError: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\cl.exe' failed with exit code 1

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for grpcio
  Building wheel for grpcio-tools (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for grpcio-tools (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [101 lines of output]
      <string>:27: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      running bdist_wheel
      running build
      running build_py
      creating build\lib.win-amd64-cpython-313\grpc_tools
      copying grpc_tools\command.py -> build\lib.win-amd64-cpython-313\grpc_tools
      copying grpc_tools\protoc.py -> build\lib.win-amd64-cpython-313\grpc_tools
      copying grpc_tools\__init__.py -> build\lib.win-amd64-cpython-313\grpc_tools
      creating build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\any.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\api.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      creating build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf\compiler
      copying grpc_tools\_proto\google\protobuf\compiler\plugin.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf\compiler  
      copying grpc_tools\_proto\google\protobuf\descriptor.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\duration.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\empty.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\field_mask.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\source_context.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\struct.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\timestamp.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\type.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      copying grpc_tools\_proto\google\protobuf\wrappers.proto -> build\lib.win-amd64-cpython-313\grpc_tools\_proto\google\protobuf
      running build_ext
      building 'grpc_tools._protoc_compiler' extension
      creating build\temp.win-amd64-cpython-313\Release\grpc_root\src\compiler
      creating build\temp.win-amd64-cpython-313\Release\grpc_tools
      creating build\temp.win-amd64-cpython-313\Release\third_party\abseil-cpp\absl\base\internal
      creating build\temp.win-amd64-cpython-313\Release\third_party\abseil-cpp\absl\container\internal
      creating build\temp.win-amd64-cpython-313\Release\third_party\abseil-cpp\absl\crc
      creating build\temp.win-amd64-cpython-313\Release\third_party\abseil-cpp\absl\crc\internal
.
.
.
.
.
313\Release\third_party\protobuf\src\google\protobuf\compiler\objectivec
      creating build\temp.win-amd64-cpython-313\Release\third_party\protobuf\src\google\protobuf\compiler\php
      creating build\temp.win-amd64-cpython-313\Release\third_party\protobuf\src\google\protobuf\compiler\python
      creating build\temp.win-amd64-cpython-313\Release\third_party\protobuf\src\google\protobuf\compiler\ruby
      creating build\temp.win-amd64-cpython-313\Release\third_party\protobuf\src\google\protobuf\compiler\rust\accessors
      creating build\temp.win-amd64-cpython-313\Release\third_party\protobuf\src\google\protobuf\io
      creating build\temp.win-amd64-cpython-313\Release\third_party\protobuf\src\google\protobuf\stubs
      creating build\temp.win-amd64-cpython-313\Release\third_party\protobuf\third_party\utf8_range
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DWIN32_LEAN_AND_MEAN=1 -DNOMINMAX=1 -DMS_WIN64=1 -I. -Igrpc_root -Igrpc_root\include -Ithird_party\abseil-cpp -Ithird_party\protobuf\src -Ithird_party\protobuf\third_party\utf8_range "-IC:\Users\AI Internist\AppData\Local\Programs\Python\Python313\include" "-IC:\Users\AI Internist\AppData\Local\Programs\Python\Python313\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /EHsc /Tpgrpc_root\src\compiler\proto_parser_helper.cc /Fobuild\temp.win-amd64-cpython-313\Release\grpc_root\src\compiler\proto_parser_helper.obj /std:c11 /MT
      cl : Command line warning D9025 : overriding '/MD' with '/MT'
      proto_parser_helper.cc
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DWIN32_LEAN_AND_MEAN=1 -DNOMINMAX=1 -DMS_WIN64=1 -I. -Igrpc_root -Igrpc_root\include -Ithird_party\abseil-cpp -Ithird_party\protobuf\src -Ithird_party\protobuf\third_party\utf8_range "-IC:\Users\AI Internist\AppData\Local\Programs\Python\Python313\include" "-IC:\Users\AI Internist\AppData\Local\Programs\Python\Python313\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /EHsc /Tpgrpc_root\src\compiler\python_generator.cc /Fobuild\temp.win-amd64-cpython-313\Release\grpc_root\src\compiler\python_generator.obj /std:c11 /MT
      cl : Command line warning D9025 : overriding '/MD' with '/MT'
      python_generator.cc
      third_party\protobuf\src\google/protobuf/map.h(689): warning C4244: 'initializing': conversion from 'uintptr_t' to 'google::protobuf::internal::map_index_t', possible loss of data
      third_party\protobuf\src\google/protobuf/io/zero_copy_sink.h(34): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
      grpc_root\src/compiler/python_generator_helpers.h(104): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
      grpc_root\src/compiler/python_generator_helpers.h(104): warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data
      grpc_root\src\compiler\python_generator.cc(852): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
      grpc_root\src\compiler\python_generator.cc(893): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data       
      grpc_root\src\compiler\python_generator.cc(893): warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data 
      "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DWIN32_LEAN_AND_MEAN=1 -DNOMINMAX=1 -DMS_WIN64=1 -I. -Igrpc_root -Igrpc_root\include -Ithird_party\abseil-cpp -Ithird_party\protobuf\src -Ithird_party\protobuf\third_party\utf8_range "-IC:\Users\AI Internist\AppData\Local\Programs\Python\Python313\include" "-IC:\Users\AI Internist\AppData\Local\Programs\Python\Python313\Include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt" /EHsc /Tpgrpc_tools\_protoc_compiler.cpp /Fobuild\temp.win-amd64-cpython-313\Release\grpc_tools\_protoc_compiler.obj /std:c11 /MT
      cl : Command line warning D9025 : overriding '/MD' with '/MT'
      _protoc_compiler.cpp
      C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\include\pyconfig.h(138): warning C4005: 'MS_WIN64': macro redefinition
      C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\include\pyconfig.h(138): note: 'MS_WIN64' previously declared on the command line
      grpc_tools\_protoc_compiler.cpp(1190): warning C4996: 'Py_UNICODE': deprecated in 3.13
      grpc_tools\_protoc_compiler.cpp(1191): warning C4996: 'Py_UNICODE': deprecated in 3.13
      grpc_tools\_protoc_compiler.cpp(2307): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int', possible loss of data
      grpc_tools\_protoc_compiler.cpp(6401): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(6413): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(6425): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(6464): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(6476): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(6493): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(6536): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(6548): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(6560): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(6572): error C3861: '_PyDict_SetItem_KnownHash': identifier not found
      grpc_tools\_protoc_compiler.cpp(8815): error C2660: '_PyLong_AsByteArray': function does not take 5 arguments
      C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\include\cpython/longobject.h(111): note: see declaration of '_PyLong_AsByteArray'
      grpc_tools\_protoc_compiler.cpp(8815): note: while trying to match the argument list '(PyLongObject *, unsigned char *, size_t, int, bool)'    
      grpc_tools\_protoc_compiler.cpp(9049): error C2660: '_PyLong_AsByteArray': function does not take 5 arguments
      C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\include\cpython/longobject.h(111): note: see declaration of '_PyLong_AsByteArray'
      grpc_tools\_protoc_compiler.cpp(9049): note: while trying to match the argument list '(PyLongObject *, unsigned char *, size_t, int, bool)'    
      grpc_tools\_protoc_compiler.cpp(9245): error C2660: '_PyLong_AsByteArray': function does not take 5 arguments
      C:\Users\AI Internist\AppData\Local\Programs\Python\Python313\include\cpython/longobject.h(111): note: see declaration of '_PyLong_AsByteArray'
      grpc_tools\_protoc_compiler.cpp(9245): note: while trying to match the argument list '(PyLongObject *, unsigned char *, size_t, int, bool)'    
      grpc_tools\_protoc_compiler.cpp(9833): error C3861: '_PyGen_SetStopIterationValue': identifier not found
      error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.42.34433\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for grpcio-tools
Failed to build grpcio grpcio-tools
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (grpcio, grpcio-tools)

我可以知道这可能是什么原因吗?我已将 pip 和 setuptools 更新到最新版本,按照建议here

点24.3.1 安装工具75.6.0

我尝试更新 pip 和 setuptools。我还确保我的 Python 和 C++ 安装了最新版本。然而,同样的错误仍然存在。

grpc grpcio
1个回答
0
投票

如果 Cython 版本有任何问题,就会出现提到

_Py*
的错误。对于 grpcio v1.62.2,请尝试在requirements.txt 文件中添加
cython>=0.29.8,<3.0.0rc1

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