grpc: pip grpcio install is (still) very slow
What version of gRPC and what language are you using?
Python, grpc==1.28.1
What operating system (Linux, Windows,…) and version?
Ubuntu 18.04
What runtime / compiler are you using (e.g. python version or version of gcc)
Python 3.6.9
What did you do?
Please provide either 1) A unit test for reproducing the bug or 2) Specific steps for us to follow to reproduce the bug. If there’s not enough information to debug the problem, gRPC team may close the issue at their discretion. You’re welcome to re-open the issue once you have a reproduction.
Install grpcio
using python pip, in a docker container
What did you expect to see?
Getting the package installed a lot quicker
What did you see instead?
Very slow install, build from source I guess. For me it takes over 3 minutes!
Anything else we should know about your project / environment?
Using a brand spanking new threadripper system with fast CPU
The following Dockerfile can be used to reproduce
FROM ubuntu:18.04
RUN apt-get update && apt-get install -qy python3-pip time
RUN time pip3 install grpcio==1.28.1
This is the same issue as https://github.com/grpc/grpc/issues/12992, which as been locked
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 14
- Comments: 19 (3 by maintainers)
Commits related to this issue
- Added patch to update pip version Ref: https://github.com/grpc/grpc/issues/22815 — committed to Click2Cloud-Centaurus/mizar by click2cloud-team1 3 years ago
- Change location-grpc-service image base to cut down build time Here is the issue related to long grpcio build time https://github.com/grpc/grpc/issues/22815 — committed to vincent6767/nd064-c2-message-passing-projects-starter by vincent6767 3 years ago
- Implement kafka (#4) * Setup Kafka * Change Kafka URL host and enable print logs * Change location-grpc-service image base to cut down build time Here is the issue related to long grpcio bui... — committed to vincent6767/nd064-c2-message-passing-projects-starter by vincent6767 3 years ago
- modify push notification settings + use fcm-django library (#998) - swaps out `django-push-notifications` for [`fcm-django`](https://github.com/grafana/fcm-django). Again.. this is a fork of the pa... — committed to grafana/oncall by joeyorlando 2 years ago
Please upgrade pip. We upgrade our binary wheel to
manylinux2010
which requires pip > 19.0.0.To elaborate on that, for @rtshadow: the manylinux2010 standard for wheels (PEP-571) assumes the presence of basic but specific runtime libraries. The most essential, glibc, is not present in the minimal Alpine image of Python. Instead, they use musl as the alternative c library to cut down image size even further. This is explained on the Docker Hub Python image description (see excerpt below), but I think those lines could be improved to include what this means with respect to compatibility of wheels.
None of this is specific to gRPC, by the way.
Also, if you want to be sure you want to use wheels only and let pip fail on that, there’s an option for that.
pip install --only-binary ":all:" grpcio
and it should hard-fail if your platform is incompatible. I haven’t found a simple way to let pip print its compatible platform tags.I’m still experiencing the same issue. Here’s how to reproduce:
I just tried to install in my machine with python 3.10 and the build took 35 mins… (mac M1, 16G RAM)
@rtshadow PyPI only support source wheels or binary wheels that comply with manylinux standard. But alpine is not included by manylinux. So, for Python packages with C extension (like gRPC, numpy),
pip
cannot download pre-compiled wheel but compile from scratch.@TalhaNaeem1 Please scroll up to read my earlier comment; you’re using an alternative Python-Docker distribution (Alpine) for which no grpcio wheels are published. (But even if there were, your version is pinned to a version predating the standard described below.)
You can see it here on PyPI; cp3X with
manylinux
tags are the wheels for glibc with CPython. Wheels for Alpine that ships with musl instead of glibc were standardized just months ago in PEP-565. If you really really really want Alpine, consider filing a feature request for gprc to build wheels targeting the numerousmusllinux
platform tags. In the meantime, use regular glibc Python images.Also, consider upgrading to a stable release of grpcio, your version is nearly 2 years old. Similar for the Python 3.7, but okay.
I.e. change your steps to:
HTH
I also noticed this a while ago when testing grpcio 1.27 releases and learned it the hard way. Wanted to leave some archeology trails here for whoever is interested. 😃