grpc: [Windows] pip install grpcio fails on Python 3.9

I’m trying to install grpcio using pip on Python 3.9 running on Windows 10. It failed. Here is the log:

Collecting grpcio
  Using cached grpcio-1.33.1.tar.gz (20.9 MB)
Requirement already satisfied: six>=1.5.2 in c:\users\kbhuv\appdata\roaming\python\python39\site-packages (from grpcio) (1.15.0)
Using legacy 'setup.py install' for grpcio, since package 'wheel' is not installed.
Installing collected packages: grpcio
    Running setup.py install for grpcio ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\users\kbhuv\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\kbhuv\\AppData\\Local\\Temp\\pip-install-exmxnphm\\grpcio\\setup.py'"'"'; __file__='"'"'C:\\Users\\kbhuv\\AppData\\Local\\Temp\\pip-install-exmxnphm\\grpcio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\kbhuv\AppData\Local\Temp\pip-record-lzd2ffg5\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\kbhuv\appdata\local\programs\python\python39\Include\grpcio'
         cwd: C:\Users\kbhuv\AppData\Local\Temp\pip-install-exmxnphm\grpcio\
    Complete output (79 lines):
    ASM Builds for BoringSSL currently not supported on: win-amd64
    Found cython-generated files...
    running install
    running build
    running build_py
    running build_project_metadata
    creating python_build
    creating python_build\lib.win-amd64-3.9
    creating python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_auth.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_channel.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_common.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_compression.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_grpcio_metadata.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_interceptor.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_plugin_wrapping.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_runtime_protos.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_server.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_simple_stubs.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\_utilities.py -> python_build\lib.win-amd64-3.9\grpc
    copying src\python\grpcio\grpc\__init__.py -> python_build\lib.win-amd64-3.9\grpc
    creating python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_base_call.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_base_channel.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_base_server.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_call.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_channel.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_interceptor.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_metadata.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_server.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_typing.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\_utils.py -> python_build\lib.win-amd64-3.9\grpc\aio
    copying src\python\grpcio\grpc\aio\__init__.py -> python_build\lib.win-amd64-3.9\grpc\aio
    creating python_build\lib.win-amd64-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\implementations.py -> python_build\lib.win-amd64-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\interfaces.py -> python_build\lib.win-amd64-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\utilities.py -> python_build\lib.win-amd64-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\_client_adaptations.py -> python_build\lib.win-amd64-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\_metadata.py -> python_build\lib.win-amd64-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\_server_adaptations.py -> python_build\lib.win-amd64-3.9\grpc\beta
    copying src\python\grpcio\grpc\beta\__init__.py -> python_build\lib.win-amd64-3.9\grpc\beta
    creating python_build\lib.win-amd64-3.9\grpc\experimental
    copying src\python\grpcio\grpc\experimental\gevent.py -> python_build\lib.win-amd64-3.9\grpc\experimental
    copying src\python\grpcio\grpc\experimental\session_cache.py -> python_build\lib.win-amd64-3.9\grpc\experimental
    copying src\python\grpcio\grpc\experimental\__init__.py -> python_build\lib.win-amd64-3.9\grpc\experimental
    creating python_build\lib.win-amd64-3.9\grpc\framework
    copying src\python\grpcio\grpc\framework\__init__.py -> python_build\lib.win-amd64-3.9\grpc\framework
    creating python_build\lib.win-amd64-3.9\grpc\_cython
    copying src\python\grpcio\grpc\_cython\__init__.py -> python_build\lib.win-amd64-3.9\grpc\_cython
    creating python_build\lib.win-amd64-3.9\grpc\experimental\aio
    copying src\python\grpcio\grpc\experimental\aio\__init__.py -> python_build\lib.win-amd64-3.9\grpc\experimental\aio
    creating python_build\lib.win-amd64-3.9\grpc\framework\common
    copying src\python\grpcio\grpc\framework\common\cardinality.py -> python_build\lib.win-amd64-3.9\grpc\framework\common
    copying src\python\grpcio\grpc\framework\common\style.py -> python_build\lib.win-amd64-3.9\grpc\framework\common
    copying src\python\grpcio\grpc\framework\common\__init__.py -> python_build\lib.win-amd64-3.9\grpc\framework\common
    creating python_build\lib.win-amd64-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\abandonment.py -> python_build\lib.win-amd64-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\callable_util.py -> python_build\lib.win-amd64-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\future.py -> python_build\lib.win-amd64-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\logging_pool.py -> python_build\lib.win-amd64-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\stream.py -> python_build\lib.win-amd64-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\stream_util.py -> python_build\lib.win-amd64-3.9\grpc\framework\foundation
    copying src\python\grpcio\grpc\framework\foundation\__init__.py -> python_build\lib.win-amd64-3.9\grpc\framework\foundation
    creating python_build\lib.win-amd64-3.9\grpc\framework\interfaces
    copying src\python\grpcio\grpc\framework\interfaces\__init__.py -> python_build\lib.win-amd64-3.9\grpc\framework\interfaces
    creating python_build\lib.win-amd64-3.9\grpc\framework\interfaces\base
    copying src\python\grpcio\grpc\framework\interfaces\base\base.py -> python_build\lib.win-amd64-3.9\grpc\framework\interfaces\base
    copying src\python\grpcio\grpc\framework\interfaces\base\utilities.py -> python_build\lib.win-amd64-3.9\grpc\framework\interfaces\base
    copying src\python\grpcio\grpc\framework\interfaces\base\__init__.py -> python_build\lib.win-amd64-3.9\grpc\framework\interfaces\base
    creating python_build\lib.win-amd64-3.9\grpc\framework\interfaces\face
    copying src\python\grpcio\grpc\framework\interfaces\face\face.py -> python_build\lib.win-amd64-3.9\grpc\framework\interfaces\face
    copying src\python\grpcio\grpc\framework\interfaces\face\utilities.py -> python_build\lib.win-amd64-3.9\grpc\framework\interfaces\face
    copying src\python\grpcio\grpc\framework\interfaces\face\__init__.py -> python_build\lib.win-amd64-3.9\grpc\framework\interfaces\face
    creating python_build\lib.win-amd64-3.9\grpc\_cython\_cygrpc
    copying src\python\grpcio\grpc\_cython\_cygrpc\__init__.py -> python_build\lib.win-amd64-3.9\grpc\_cython\_cygrpc
    creating python_build\lib.win-amd64-3.9\grpc\_cython\_credentials
    copying src\python\grpcio\grpc\_cython\_credentials\roots.pem -> python_build\lib.win-amd64-3.9\grpc\_cython\_credentials
    running build_ext
    error: [WinError 2] The system cannot find the file specified
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\kbhuv\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\kbhuv\\AppData\\Local\\Temp\\pip-install-exmxnphm\\grpcio\\setup.py'"'"'; __file__='"'"'C:\\Users\\kbhuv\\AppData\\Local\\Temp\\pip-install-exmxnphm\\grpcio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\kbhuv\AppData\Local\Temp\pip-record-lzd2ffg5\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\kbhuv\appdata\local\programs\python\python39\Include\grpcio' Check the logs for full command output.
WARNING: You are using pip version 20.2.3; however, version 20.2.4 is available.
You should consider upgrading via the 'c:\users\kbhuv\appdata\local\programs\python\python39\python.exe -m pip install --upgrade pip' command.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Link to another 3.9 issue: https://github.com/grpc/grpc/issues/24344.

There are still issues with our Windows CI. We will publish precompiled Windows wheels for 3.9 once that tis fixed.

hello @lidizheng, please see below for the error I’m getting when trying to install the grpcio tools for python. Again, it’s python 3.9 with macOS Big Sur and clang version

Apple clang version 12.0.0 (clang-1200.0.32.28) Target: x86_64-apple-darwin20.2.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

----------------------------------------

ERROR: Command errored out with exit status 1: /usr/local/opt/python@3.9/bin/python3.9 -u -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/private/var/folders/sh/ml_cqh3d6vn8f4f__yx0p34d62kd9k/T/pip-install-tl7mjysu/grpcio/setup.py’“'”‘; file=’“'”‘/private/var/folders/sh/ml_cqh3d6vn8f4f__yx0p34d62kd9k/T/pip-install-tl7mjysu/grpcio/setup.py’“'”‘;f=getattr(tokenize, ‘"’“‘open’”’“‘, open)(file);code=f.read().replace(’”‘"’\r\n’“'”‘, ‘"’"’\n’“'”‘);f.close();exec(compile(code, file, ‘"’“‘exec’”’"‘))’ install --record /private/var/folders/sh/ml_cqh3d6vn8f4f__yx0p34d62kd9k/T/pip-record-pk3s16fg/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.9/grpcio Check the logs for full command output.

There is a huge number of clang errors that arrive right before this one. Here’s an example.

Traceback (most recent call last): File “/private/var/folders/sh/ml_cqh3d6vn8f4f__yx0p34d62kd9k/T/pip-install-tl7mjysu/grpcio/src/python/grpcio/commands.py”, line 267, in build_extensions build_ext.build_ext.build_extensions(self) File “/usr/local/lib/python3.9/site-packages/Cython/Distutils/old_build_ext.py”, line 195, in build_extensions _build_ext.build_ext.build_extensions(self) File “/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py”, line 449, in build_extensions self._build_extensions_serial() File “/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py”, line 474, in _build_extensions_serial self.build_extension(ext) File “/usr/local/lib/python3.9/site-packages/setuptools/command/build_ext.py”, line 196, in build_extension _build_ext.build_extension(self, ext) File “/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/command/build_ext.py”, line 529, in build_extension objects = self.compiler.compile(sources, File “/private/var/folders/sh/ml_cqh3d6vn8f4f__yx0p34d62kd9k/T/pip-install-tl7mjysu/grpcio/src/python/grpcio/_parallel_compile_patch.py”, line 58, in _parallel_compile multiprocessing.pool.ThreadPool(BUILD_EXT_COMPILER_JOBS).map( File “/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py”, line 364, in map return self._map_async(func, iterable, mapstar, chunksize).get() File “/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py”, line 771, in get raise self._value File “/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py”, line 125, in worker result = (True, func(*args, **kwds)) File “/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py”, line 48, in mapstar return list(map(*args)) File “/private/var/folders/sh/ml_cqh3d6vn8f4f__yx0p34d62kd9k/T/pip-install-tl7mjysu/grpcio/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 “/private/var/folders/sh/ml_cqh3d6vn8f4f__yx0p34d62kd9k/T/pip-install-tl7mjysu/grpcio/src/python/grpcio/commands.py”, line 250, in new_compile return old_compile(obj, src, ext, cc_args, extra_postargs, File “/usr/local/Cellar/python@3.9/3.9.0_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/distutils/unixccompiler.py”, line 120, in _compile raise CompileError(msg) distutils.errors.CompileError: command ‘/usr/bin/clang’ failed with exit code 1

@murphyj8 Are you using the latest Apple M1? If so, then you need arm64 binary wheels instead of x86_64 wheels. We currently don’t have arm64 machines to build binary wheels, so you will need to use arch -x86_64 to emulate x86_64 architecture.

If not, please try to manually download and install the grpcio-tools wheel (https://pypi.org/project/grpcio-tools/#files).

@gnossen The real cause could be elsewhere but pthread.h was the only fatal error I noticed. Attaching the full pip install grpcio logs, search fatal error for the pthread.h issue.

Happy to help finding the cause and getting it built. grpcio-build.log

@cafegoci Windows wheels for Python 3.9 are being tracked by https://github.com/grpc/grpc/issues/24344

OSX and Linux wheels are already available.

Windows build with Python 3.9 using VS 2019 Build Tools is also failing for me, hopefully it gets fixed together with #24344. Mine fails with

src\python\grpcio\grpc/_cython/cygrpc.cpp(1680): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory

using C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe