---
slug: "python-grpcio-install-compile-error"
title: "Cannot Build Python's grpcio"
description: "Fix compile errors when installing Python's `grpcio` — workarounds for missing C++ headers and CFLAGS adjustments to make `pip install grpcio` succeed."
url: "https://www.ytyng.com/en/blog/python-grpcio-install-compile-error"
publish_date: "2021-02-09T12:09:24Z"
created: "2021-02-09T12:09:24Z"
updated: "2026-05-11T13:21:28.807Z"
categories: []
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20250605/2518018086c24e609365f2078b60ed2d.png.webp?width=768"
has_video: true
has_music: true
video_urls: ["https://media.ytyng.net/ytyng-blog/193/featured-video-1.mp4", "https://media.ytyng.net/ytyng-blog/193/featured-video-2.mp4", "https://media.ytyng.net/ytyng-blog/193/featured-video-3.mp4"]
music_urls: ["https://media.ytyng.net/ytyng-blog/193/featured-music-193-3.mp3", "https://media.ytyng.net/ytyng-blog/193/featured-music-193-4.mp3"]
lang: "en"
---

# Cannot Build Python's grpcio

<p>Libraries dependent on firebase-admin, etc.</p>
<p></p>
<p>When trying to install grpcio around version 1.35.0</p>
<p></p>
<p></p>
<pre> raise CommandError(<br /> commands.CommandError: Failed `build_ext` step:<br /> Traceback (most recent call last):<br /> File "/usr/lib/python3.8/distutils/unixccompiler.py", line 117, in _compile<br /> self.spawn(compiler_so + cc_args + [src, '-o', obj] +<br /> File "/tmp/pip-install-btumpli3/grpcio_661e3a031b984ee589514363a3992607/src/python/grpcio/_spawn_patch.py", line 54, in _commandfile_spawn<br /> _classic_spawn(self, command)<br /> File "/usr/lib/python3.8/distutils/ccompiler.py", line 910, in spawn<br /> spawn(cmd, dry_run=self.dry_run)<br /> File "/usr/lib/python3.8/distutils/spawn.py", line 36, in spawn<br /> _spawn_posix(cmd, search_path, dry_run=dry_run)<br /> File "/usr/lib/python3.8/distutils/spawn.py", line 157, in _spawn_posix<br /> raise DistutilsExecError(<br /> distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1<br /> <br /> During handling of the above exception, another exception occurred:<br /> <br /> Traceback (most recent call last):<br /> File "/tmp/pip-install-btumpli3/grpcio_661e3a031b984ee589514363a3992607/src/python/grpcio/commands.py", line 267, in build_extensions<br /> build_ext.build_ext.build_extensions(self)<br /> File "/usr/lib/python3.8/distutils/command/build_ext.py", line 449, in build_extensions<br /> self._build_extensions_serial()<br /> File "/usr/lib/python3.8/distutils/command/build_ext.py", line 474, in _build_extensions_serial<br /> self.build_extension(ext)<br /> File "/usr/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 196, in build_extension<br /> _build_ext.build_extension(self, ext)<br /> File "/usr/lib/python3.8/distutils/command/build_ext.py", line 528, in build_extension<br /> objects = self.compiler.compile(sources,<br /> File "/tmp/pip-install-btumpli3/grpcio_661e3a031b984ee589514363a3992607/src/python/grpcio/_parallel_compile_patch.py", line 58, in _parallel_compile<br /> multiprocessing.pool.ThreadPool(BUILD_EXT_COMPILER_JOBS).map(<br /> File "/usr/lib/python3.8/multiprocessing/pool.py", line 364, in map<br /> return self._map_async(func, iterable, mapstar, chunksize).get()<br /> File "/usr/lib/python3.8/multiprocessing/pool.py", line 771, in get<br /> raise self._value<br /> File "/usr/lib/python3.8/multiprocessing/pool.py", line 125, in worker<br /> result = (True, func(*args, **kwds))<br /> File "/usr/lib/python3.8/multiprocessing/pool.py", line 48, in mapstar<br /> return list(map(*args))<br /> File "/tmp/pip-install-btumpli3/grpcio_661e3a031b984ee589514363a3992607/src/python/grpcio/_parallel_compile_patch.py", line 54, in _compile_single_file<br /> self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)<br /> File "/usr/lib/python3.8/distutils/unixccompiler.py", line 120, in _compile<br /> raise CompileError(msg)<br /> distutils.errors.CompileError: command 'gcc' failed with exit status 1<br /> <br /> ----------------------------------------<br />ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-btumpli3/grpcio_661e3a031b984ee589514363a3992607/setup.py'"'"'; __file__='"'"'/tmp/pip-install-btumpli3/grpcio_661e3a031b984ee589514363a3992607/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-1k_g3jbc/install-record.txt --single-version-externally-managed --compile --install-headers /usr/include/python3.8/grpcio Check the logs for full command output.<br />/</pre>
<p><br />When this happens</p>
<p>If you are in a hurry, you might be able to install grpcio version 1.30.0</p>
<pre>pip install grpcio==1.30.0</pre>
<p></p>
<p></p>
