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

Most upvoted comments

Please upgrade pip. We upgrade our binary wheel to manylinux2010 which requires pip > 19.0.0.

pip install --upgrade pip

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.

Screenshot_20200626_153149


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:

docker run -it --rm --entrypoint /bin/sh python:3.7-alpine
apk update && apk upgrade && apk add build-base # without this grpcio install will fail with "No such file or directory: 'cc': 'cc'"
pip install --upgrade pip
pip install grpcio==1.30.0

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 numerous musllinux 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:

docker run -it --rm --entrypoint /bin/sh python:3.10
pip install --upgrade pip
pip install grpcio==1.44.0

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. 😃

  • This was changed intentionally via #20282 initially (surfaced in 1.27.0)
  • Then reverted for 1.27.1 in #21924
  • Re-enabled via #21780 (surfaced in 1.28.0).