Hi I’m trying to install the grpc
python package via pip. It is actually intended to be installed by a build script for another setup that I am doing but the script kept on failing so I decided to do it myself.
Here is what I get:
❯ pip3 install grpc
Defaulting to user installation because normal site-packages is not writeable
Collecting grpc
Using cached grpc-1.0.0.tar.gz (5.2 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-_au3535m/grpc_0b2b1ce7560943288874cf94aa72394a/setup.py", line 33, in <module>
raise RuntimeError(HINT)
RuntimeError: Please install the official package with: pip install grpcio
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
I have tried following the hint:
pip install grpcio
and it ran without any troubles. I also visited a plethora of forums by searching the keywords: “setup.py egg_info did not run successfully” and all suggested doing:
pip install --upgrade pip
pip install --upgrade setuptools
I tried both and here is what I get:
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in /home/utl/.local/lib/python3.10/site-packages (24.0)
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (69.5.1)
And yet when I run pip install grpc
afterwards it does not work and I get the same error as before. I’ve been struggling with the build script for quite some time now so any help is very appreciated.
You can’t (and shouldn’t try to) install the grpc
PyPI package because it’s just a stub that tells you to install grpcio
instead.
The grpcio
PyPI package provides the grpc
Python package:
# pip install grpcio
Collecting grpcio
Successfully installed grpcio-1.63.0
# python
Python 3.12.1 (main, Jan 17 2024, 06:18:08) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import grpc
>>> grpc
<module 'grpc' from '/usr/local/lib/python3.12/site-packages/grpc/__init__.py'>
>>>
If you have a build script that is trying to install grpc
, that script is broken and/or out-dated.