thingsboard gateway 编译报错

以下记录是处理过程, 最终解决办法在最后有写哦, 主要思路即解决grpcio安装问题      

During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\HUAWEI\AppData\Local\Temp\pip-install-9l7w5f0l\grpcio_1a5875cb655943c08af0e49641be4521\src\python\grpcio\commands.py", line 285, in build_extensions
          build_ext.build_ext.build_extensions(self)
        File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\Cython\Distutils\old_build_ext.py", line 195, in build_extensions
          _build_ext.build_ext.build_extensions(self)
        File "C:\Users\HUAWEI\.conda\envs\gw\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "C:\Users\HUAWEI\.conda\envs\gw\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "C:\Users\HUAWEI\.conda\envs\gw\lib\site-packages\setuptools\command\build_ext.py", line 246, in build_extension
          _build_ext.build_extension(self, ext)
        File "C:\Users\HUAWEI\.conda\envs\gw\lib\site-packages\setuptools\_distutils\command\build_ext.py", line 548, in build_extension
          objects = self.compiler.compile(
        File "C:\Users\HUAWEI\.conda\envs\gw\lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 428, in compile
          raise CompileError(msg)
      distutils.errors.CompileError: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\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
  Running setup.py clean for grpcio
Failed to build grpcio
ERROR: Could not build wheels for grpcio, which is required to install pyproject.toml-based projects

解决办法:

python.exe -m pip install --user --upgrade pip

pip install --user --upgrade setuptools

pip3 install --no-cache-dir --force-reinstall -Iv grpcio==1.40.0

遇到报错

ERROR: Could not build wheels for grpcio, which is required to install pyproject.toml-based projects

具体错误

   C:\Users\HUAWEI\AppData\Local\Temp\pip-install-e7nx97h2\grpcio_2ccb5f40ca594c3eaf16c86220c7a967\src\core\ext\upb-generated\envoy\extensions\filters\network\http_connection_manager\v3\http_connection_manager.upb.c : fatal error C1083: 无法打开编译器生成的文件: “”: Invalid argument
  creating Users
  creating Users\HUAWEI
  creating Users\HUAWEI\AppData
  creating Users\HUAWEI\AppData\Local
  creating Users\HUAWEI\AppData\Local\Temp
  creating Users\HUAWEI\AppData\Local\Temp\tmp705lwr46
  "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -IC:\Users\HUAWEI\.conda\envs\gw\include -IC:\Users\HUAWEI\.conda\envs\gw\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.36.32532\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.22000.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.22000.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /TcC:\Users\HUAWEI\AppData\Local\Temp\tmp705lwr46\a.c /FoUsers\HUAWEI\AppData\Local\Temp\tmp705lwr46\a.obj
  a.c
  Traceback (most recent call last):
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\_msvccompiler.py", line 529, in _fallback_spawn
      yield bag
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\_msvccompiler.py", line 517, in spawn
      return super().spawn(cmd, env=env)
  TypeError: _commandfile_spawn() got an unexpected keyword argument 'env'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\_msvccompiler.py", line 419, in compile
      self.spawn(args)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\_msvccompiler.py", line 516, in spawn
      with self._fallback_spawn(cmd, env) as fallback:
    File "C:\Users\HUAWEI\.conda\envs\gw\lib\contextlib.py", line 153, in __exit__
      self.gen.throw(typ, value, traceback)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\_msvccompiler.py", line 537, in _fallback_spawn
      bag.value = super().spawn(cmd)
    File "C:\Users\HUAWEI\AppData\Local\Temp\pip-install-e7nx97h2\grpcio_2ccb5f40ca594c3eaf16c86220c7a967\src\python\grpcio\_spawn_patch.py", line 54, in _commandfile_spawn
      _classic_spawn(self, command)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\ccompiler.py", line 1041, in spawn
      spawn(cmd, dry_run=self.dry_run, **kwargs)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\spawn.py", line 70, in spawn
      raise DistutilsExecError(
  distutils.errors.DistutilsExecError: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\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\HUAWEI\AppData\Local\Temp\pip-install-e7nx97h2\grpcio_2ccb5f40ca594c3eaf16c86220c7a967\src\python\grpcio\commands.py", line 285, in build_extensions
      build_ext.build_ext.build_extensions(self)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\Cython\Distutils\old_build_ext.py", line 195, in build_extensions
      _build_ext.build_ext.build_extensions(self)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\command\build_ext.py", line 467, in build_extensions
      self._build_extensions_serial()
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\command\build_ext.py", line 493, in _build_extensions_serial
      self.build_extension(ext)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\command\build_ext.py", line 246, in build_extension
      _build_ext.build_extension(self, ext)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\command\build_ext.py", line 548, in build_extension
      objects = self.compiler.compile(
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\_msvccompiler.py", line 421, in compile
      raise CompileError(msg)
  distutils.errors.CompileError: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\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 "", line 2, in 
    File "", line 34, in 
    File "C:\Users\HUAWEI\AppData\Local\Temp\pip-install-e7nx97h2\grpcio_2ccb5f40ca594c3eaf16c86220c7a967\setup.py", line 524, in 
      setuptools.setup(
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\__init__.py", line 107, in setup
      return distutils.core.setup(**attrs)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\core.py", line 185, in setup
      return run_commands(dist)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\core.py", line 201, in run_commands
      dist.run_commands()
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\dist.py", line 1234, in run_command
      super().run_command(command)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\HUAWEI\.conda\envs\gw\lib\site-packages\wheel\bdist_wheel.py", line 325, in run
      self.run_command("build")
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\dist.py", line 1234, in run_command
      super().run_command(command)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\command\build.py", line 131, in run
      self.run_command(cmd_name)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\cmd.py", line 318, in run_command
      self.distribution.run_command(command)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\dist.py", line 1234, in run_command
      super().run_command(command)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\dist.py", line 988, in run_command
      cmd_obj.run()
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\command\build_ext.py", line 84, in run
      _build_ext.run(self)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
      _build_ext.build_ext.run(self)
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\command\build_ext.py", line 345, in run
      self.build_extensions()
    File "C:\Users\HUAWEI\AppData\Local\Temp\pip-install-e7nx97h2\grpcio_2ccb5f40ca594c3eaf16c86220c7a967\src\python\grpcio\commands.py", line 289, in build_extensions
      raise CommandError(
  commands.CommandError: Failed `build_ext` step:
  Traceback (most recent call last):
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\_msvccompiler.py", line 529, in _fallback_spawn
      yield bag
    File "C:\Users\HUAWEI\AppData\Roaming\Python\Python310\site-packages\setuptools\_distutils\_msvccompiler.py", line 517, in spawn
      return super().spawn(cmd, env=env)
  TypeError: _commandfile_spawn() got an unexpected keyword argument 'env'

分析原因: 看到错误日志里面 有C:\Users\HUAWEI\AppData\Roaming\Python\Python310 , 这个是python 3.10 版本的, 而我使用conda创建了新的环境

conda create --name gw python=3.10

所以不应该出现以前的旧的 python310的路径, 从环境变量里面PATH找到对应的 Python310, 删除之, 重新编译仍然报错, 在设置-> 应用里面找到所有Python安装软件 卸载, 只保留conda

仍然报错, 换环境, 换成python=3.11

仍然报错

核心报错: 

 return super().spawn(cmd, env=env)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
      TypeError: _commandfile_spawn() got an unexpected keyword argument 'env'

查到如下issue

https://github.com/pypa/distutils/issues/15

尝试解决办法

set SETUPTOOLS_USE_DISTUTILS=stdlib

接着install

pip install -r requirements.txt

报新的错误

修改 setuptools 版本 setuptools<=49.1.2

仍然不行

按官方文档 [IoT Gateway installation from sources. | ThingsBoard IoT Gateway], 使用ubuntu编译仍然报错

x-x86_64-cpython-311/src/core/ext/xds/xds_client_stats.o -std=c++11 -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions -pthread
      cc1plus: warning: command-line option ‘-std=gnu99’ is valid for C/ObjC but not for C++
      creating None
      creating None/tmp
      creating None/tmp/tmpszwkvkw9
      gcc -pthread -B /home/gaosong/anaconda3/envs/gw/compiler_compat -DNDEBUG -fwrapv -O2 -Wall -fPIC -O2 -isystem /home/gaosong/anaconda3/envs/gw/include -fPIC -O2 -isystem /home/gaosong/anaconda3/envs/gw/include -fPIC -I/home/gaosong/anaconda3/envs/gw/include/python3.11 -c /tmp/tmpszwkvkw9/a.c -o None/tmp/tmpszwkvkw9/a.o
      Traceback (most recent call last):
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py", line 185, in _compile
          self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn
          _classic_spawn(self, command)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn
          spawn(cmd, dry_run=self.dry_run, **kwargs)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn
          raise DistutilsExecError(
      distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/src/python/grpcio/commands.py", line 285, in build_extensions
          build_ext.build_ext.build_extensions(self)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
          _build_ext.build_extension(self, ext)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension
          objects = self.compiler.compile(
                    ^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/src/python/grpcio/_parallel_compile_patch.py", line 58, in _parallel_compile
          multiprocessing.pool.ThreadPool(BUILD_EXT_COMPILER_JOBS).map(
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/multiprocessing/pool.py", line 367, in map
          return self._map_async(func, iterable, mapstar, chunksize).get()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/multiprocessing/pool.py", line 774, in get
          raise self._value
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/multiprocessing/pool.py", line 125, in worker
          result = (True, func(*args, **kwds))
                          ^^^^^^^^^^^^^^^^^^^
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/multiprocessing/pool.py", line 48, in mapstar
          return list(map(*args))
                 ^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/src/python/grpcio/_parallel_compile_patch.py", line 54, in _compile_single_file
          self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile
          raise CompileError(msg)
      distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code 1
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "", line 2, in 
        File "", line 34, in 
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/setup.py", line 524, in 
          setuptools.setup(
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 325, in run
          self.run_command("build")
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/src/python/grpcio/commands.py", line 289, in build_extensions
          raise CommandError(
      commands.CommandError: Failed `build_ext` step:
      Traceback (most recent call last):
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py", line 185, in _compile
          self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn
          _classic_spawn(self, command)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn
          spawn(cmd, dry_run=self.dry_run, **kwargs)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn
          raise DistutilsExecError(
      distutils.errors.DistutilsExecError: command '/usr/bin/gcc' failed with exit code 1
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/src/python/grpcio/commands.py", line 285, in build_extensions
          build_ext.build_ext.build_extensions(self)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 246, in build_extension
          _build_ext.build_extension(self, ext)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension
          objects = self.compiler.compile(
                    ^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/src/python/grpcio/_parallel_compile_patch.py", line 58, in _parallel_compile
          multiprocessing.pool.ThreadPool(BUILD_EXT_COMPILER_JOBS).map(
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/multiprocessing/pool.py", line 367, in map
          return self._map_async(func, iterable, mapstar, chunksize).get()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/multiprocessing/pool.py", line 774, in get
          raise self._value
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/multiprocessing/pool.py", line 125, in worker
          result = (True, func(*args, **kwds))
                          ^^^^^^^^^^^^^^^^^^^
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/multiprocessing/pool.py", line 48, in mapstar
          return list(map(*args))
                 ^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-ko5bvn1_/grpcio_4478e5e74c1d43f28fb1b34159afc4a0/src/python/grpcio/_parallel_compile_patch.py", line 54, in _compile_single_file
          self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
        File "/home/gaosong/anaconda3/envs/gw/lib/python3.11/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile
          raise CompileError(msg)
      distutils.errors.CompileError: command '/usr/bin/gcc' 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
  Running setup.py clean for grpcio
Failed to build grpcio
ERROR: Could not build wheels for grpcio, which is required to install pyproject.toml-based projects

问题主要出在grpcio的编译上面

最终解决办法:

将grpcio版本去掉,使用最新版本,

即由 grpcio==1.40.0 改成 grpcio

你可能感兴趣的:(thingsboard,grpcio)