Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip grpcio install is (still) very slow #22815

Closed
koliyo opened this issue Apr 29, 2020 · 19 comments
Closed

pip grpcio install is (still) very slow #22815

koliyo opened this issue Apr 29, 2020 · 19 comments

Comments

@koliyo
Copy link

koliyo commented Apr 29, 2020

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 #12992, which as been locked

@anwald
Copy link

anwald commented Apr 30, 2020

I hit the same issue and noticed that pip was downloading the source and building instead of getting the pre-built wheel. It looks like all the pre-built wheels should be found: https://pypi.org/project/grpcio/1.28.1/#files This is not the case. I changed version to 1.27.2 and it found the wheel just fine. So this is possibly a bug in PyPi indexes? The release of grpc==1.28.1 was 27 days ago.

@lidizheng
Copy link
Contributor

lidizheng commented Apr 30, 2020

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

pip install --upgrade pip

@gertvdijk
Copy link

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. :)

@lidizheng
Copy link
Contributor

Thanks for gathering the links @gertvdijk. Closing this issue.

@przemekpastuszka
Copy link

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

@lidizheng
Copy link
Contributor

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

@gertvdijk
Copy link

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.

@przemekpastuszka
Copy link

@lidizheng @gertvdijk - that makes sense. Thank you for the explanation.

click2cloud-team1 added a commit to Click2Cloud-Centaurus/mizar that referenced this issue Oct 13, 2021
vincent6767 added a commit to vincent6767/nd064-c2-message-passing-projects-starter that referenced this issue Oct 17, 2021
Here is the issue related to long grpcio build time  grpc/grpc#22815
vincent6767 added a commit to vincent6767/nd064-c2-message-passing-projects-starter that referenced this issue Oct 20, 2021
* 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 build time  grpc/grpc#22815

* Add troubleshoot log

* Change into simpler value for troubleshooting purpose

* Add try-except for troubleshooting purpose

* Remove unnecessary error

* Add more information about the error

* Fix formatting error

* Add more information about error related for troubleshooting purpose

* Change into sequence of octets

* Change the request value into bytes

* Setup location consumer

* Decode message value

* Decode bytes into Dictionary

* Fix no attribute error due incorrect key access

* Add insert new record logic to PostgresSQL

* Add PIP upgrade

* Add additional parameter

* add python parameter

* Change base image and dependencies

* Add try-except and move the save logic into the loop

* Remove finally in try-except block

* Add keyboard interrupt and add mock value for coordinate

* Add rollback for failed command

* Fix no "count" attribute error

* Calculate the coordinate based on the latitude and longitude

* Add POINT function

* Insert Geom value with ST_GeomFromText

* Convert string into float for latitude and longitude

* Remove geoalchemy libraries

* Remove unnecessary logs
@Dragon1573
Copy link

Programming Language & gRPC version?

Python, gRPC v1.41.1

Operating System?

Ubuntu 16.04.7 (Xenial) LTS, it's an online virtual device provided by Lanqiao.

Runtime / Compiler Version?

Python 3.5.2

Steps to reproduce?

sudo pip3 install -U pip         # Using a self-hosted PyPI mirror, really fast!
sudo pip3 install tensorflow     # Really fast downloading, but REALLY SLOW builing wheels ...
                                 # Tensorflow v2.x needs grpcio as a kind of dependencies.

What did I expect to see?

pip downloads the pre-compiled *.whl package file for me and install it very soon.

What did I see instead?

  1. pip downloaded *.tar.gz archive file instead of *.whl file.
  2. For those packages *.whl installed from *.whl file, the installation process of them were fast.
  3. termcolor also needs to be compiled into *.whl file on myself, but the compilation & installation process of it was as fast as directly installed with *.whl without compilation.
  4. The whole installation process of tensorflow and other dependencies used 30 minutes. grpcio spent most of them.

@gertvdijk
Copy link

gertvdijk commented Nov 25, 2021

Ubuntu 16.04.7

Oof. This version of Ubuntu is EoL since end of April 2021 and is only supported through a commercial subscription.

Python 3.5.2

This version of Python is very old and EoL. It's unlikely that software vendors are producing wheels for this version.

Try to upgrade your Python version. I can recommend pyenv to install different Python versions on your system. Then use a python-venv with a newer interpreter to install grpc in. Alternatively, use a (Docker) container with a more modern OS & Python to run and install your software in.

@Dragon1573
Copy link

Try to upgrade your Python version.

Sorry, I can't achieve that ...

Although Lanqiao online virtual device does provide us sudo authentication without password, any modifications of the V-dev is only available in a single "experiment". If we finish the experiment and terminate the device, all stuff will be erased and rollback to default waiting for other learners to logged in remotely. 😭

I can recommend Pyenv to install different Python versions on your system.

I can't sure if Lanqiao V-devs installed Pyenv as default. But I found that Lanqiao is using Anaconda 3 "base" environment as global intepreter. I'm using Miniconda 3 (conda v4.10.1) and Conda virtual environment (Python 3.7.11) on my OWN device (Microsoft Windows 10 Home China 21H1). Is it also acceptable to use Conda for installing different Python versions? 😕

Alternatively, use a container (Docker or Kubernates) container with a more modern OS & Python to run and install your software in.

Lanqiao DOES provide some V-devs containing Docker or Kubernates installations, but they are isolated for different usage ... (They are only available if you're actually learning Docker or K8s courses) For the above exact course, it DOESN'T provide Docker or K8s. 😞


I have no authorization to modify the default configurations of Lanqiao V-devs. I think report it to Lanqiao Official Team and mention this issue may be the best way. They may can update the OS & Python version and solve the entire problem.

I'll try to ask them for further help. Thanks for your instructions, @gertvdijk ❤️

@Dragon1573
Copy link

Lanqiao Official Team just pay attention to this issue 1 hour ago.Most of the courses are sharing the same environment so switching Python intepreter to a new version may affect all of them. But after 30 minutes tests & evaluations, they finally update to Python v3.8.10 and solve the problem. The installation time of Tensorflow v2.x immediately reduce to around 4 minites (downloading 489.6MB *.whl file of Tensorflow is kind a bit slow)! 🎉

Thank you again, @gertvdijk ❤️

Installation Logs on Lanqiao V-devs
shiyanlou:project/ $ python3 --version
Python 3.8.10
shiyanlou:project/ $ sudo pip3 install -U pip
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting pip
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a4/6d/6463d49a933f547439d6b5b98b46af8742cc03ae83543e4d7688c2420f8b/pip-21.3.1-py3-none-any.whl (1.7 MB)
     |████████████████████████████████| 1.7 MB 14.6 MB/s 
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.0.2
    Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'pip'. No files were found to uninstall.
Successfully installed pip-21.3.1
shiyanlou:project/ $ pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
shiyanlou:project/ $ sudo pip3 install tensorflow
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting tensorflow
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/72/8a/033b584f8dd863c07aa8877c2dd231777de0bb0b1338f4ac6a81999980ee/tensorflow-2.7.0-cp38-cp38-manylinux2010_x86_64.whl (489.6 MB)
     |████████████████████████████████| 489.6 MB 10 kB/s             
Collecting flatbuffers<3.0,>=1.12
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/3d/d0/26033c70d642fbc1e35d3619cf3210986fb953c173b1226709f75056c149/flatbuffers-2.0-py2.py3-none-any.whl (26 kB)
Collecting keras<2.8,>=2.7.0rc0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/6b/8b/065f94ba03282fa41b2d76942b87a180a9913312c4611ea7d6508fbbc114/keras-2.7.0-py2.py3-none-any.whl (1.3 MB)
     |████████████████████████████████| 1.3 MB 584 kB/s            
Requirement already satisfied: six>=1.12.0 in /usr/lib/python3/dist-packages (from tensorflow) (1.14.0)
Collecting wrapt>=1.11.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/8a/fc/726a690e5b38f54e9a8c869da76f0a35713bbdac84661472517e8a6d2383/wrapt-1.13.3-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (84 kB)
     |████████████████████████████████| 84 kB 8.1 MB/s             
Requirement already satisfied: numpy>=1.14.5 in /usr/local/lib/python3.8/dist-packages (from tensorflow) (1.21.2)
Collecting libclang>=9.0.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/76/2d/7b0f7f5519669f11e66028fa227d4bcda4d77411d52d26c661676db82338/libclang-12.0.0-py2.py3-none-manylinux1_x86_64.whl (13.4 MB)
     |████████████████████████████████| 13.4 MB 479 kB/s            
Collecting grpcio<2.0,>=1.24.3
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/45/1e/31235024d0e7bfabd5e7e50d4e727631a7d23c677e7d34d1556ae9c24c16/grpcio-1.42.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.0 MB)
     |████████████████████████████████| 4.0 MB 30.3 MB/s            
Collecting absl-py>=0.4.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/2c/03/e3e19d3faf430ede32e41221b294e37952e06acc96781c417ac25d4a0324/absl_py-1.0.0-py3-none-any.whl (126 kB)
     |████████████████████████████████| 126 kB 2.2 MB/s            
Collecting typing-extensions>=3.6.6
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/17/61/32c3ab8951142e061587d957226b5683d1387fb22d95b4f69186d92616d1/typing_extensions-4.0.0-py3-none-any.whl (22 kB)
Collecting gast<0.5.0,>=0.2.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/b6/48/583c032b79ae5b3daa02225a675aeb673e58d2cb698e78510feceb11958c/gast-0.4.0-py3-none-any.whl (9.8 kB)
Collecting opt-einsum>=2.3.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bc/19/404708a7e54ad2798907210462fd950c3442ea51acc8790f3da48d2bee8b/opt_einsum-3.3.0-py3-none-any.whl (65 kB)
     |████████████████████████████████| 65 kB 9.7 MB/s              
Collecting protobuf>=3.9.2
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/c3/64/47ecccba745216c8ac4f590cc0af9405aa3254ae035dcc8e167379769fc5/protobuf-3.19.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB)
     |████████████████████████████████| 1.1 MB 117.1 MB/s            
Requirement already satisfied: wheel<1.0,>=0.32.0 in /usr/lib/python3/dist-packages (from tensorflow) (0.34.2)
Collecting keras-preprocessing>=1.1.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/79/4c/7c3275a01e12ef9368a892926ab932b33bb13d55794881e3573482b378a7/Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)
     |████████████████████████████████| 42 kB 1.2 MB/s             
Collecting termcolor>=1.1.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz (3.9 kB)
  Preparing metadata (setup.py) ... done
Collecting astunparse>=1.6.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl (12 kB)
Collecting tensorboard~=2.6
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/2d/eb/80f75ab480cfbd032442f06ec7c15ef88376c5ef7fd6f6bf2e0e03b47e31/tensorboard-2.7.0-py3-none-any.whl (5.8 MB)
     |████████████████████████████████| 5.8 MB 231 kB/s            
Collecting tensorflow-estimator<2.8,~=2.7.0rc0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/db/de/3a71ad41b87f9dd424e3aec3b0794a60f169fa7e9a9a1e3dd44290b86dd6/tensorflow_estimator-2.7.0-py2.py3-none-any.whl (463 kB)
     |████████████████████████████████| 463 kB 1.2 MB/s            
Collecting h5py>=2.9.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/d4/d8/6a121064f0e357dc24e5ab53945e9ec057bb1e5ca7da60355d06c89a3d36/h5py-3.6.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (4.5 MB)
     |████████████████████████████████| 4.5 MB 255 kB/s            
Collecting google-pasta>=0.1.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a3/de/c648ef6835192e6e2cc03f40b19eeda4382c49b5bafb43d88b931c4c74ac/google_pasta-0.2.0-py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 13.0 MB/s            
Collecting tensorflow-io-gcs-filesystem>=0.21.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/64/27/035440477aee18d8cd9f13fc83f2d1066a6b87e75c2d60bea9dcdb876b36/tensorflow_io_gcs_filesystem-0.22.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (2.1 MB)
     |████████████████████████████████| 2.1 MB 239 kB/s            
Collecting markdown>=2.6.8
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/9f/d4/2c7f83915d437736996b2674300c6c4b578a6f897f34e40f5c04db146719/Markdown-3.3.6-py3-none-any.whl (97 kB)
     |████████████████████████████████| 97 kB 4.4 MB/s            
Requirement already satisfied: setuptools>=41.0.0 in /usr/lib/python3/dist-packages (from tensorboard~=2.6->tensorflow) (45.2.0)
Collecting google-auth-oauthlib<0.5,>=0.4.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/b1/0e/0636cc1448a7abc444fb1b3a63655e294e0d2d49092dc3de05241be6d43c/google_auth_oauthlib-0.4.6-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: requests<3,>=2.21.0 in /usr/lib/python3/dist-packages (from tensorboard~=2.6->tensorflow) (2.22.0)
Collecting tensorboard-data-server<0.7.0,>=0.6.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/60/f9/802efd84988bffd9f644c03b6e66fde8e76c3aa33db4279ddd11c5d61f4b/tensorboard_data_server-0.6.1-py3-none-manylinux2010_x86_64.whl (4.9 MB)
     |████████████████████████████████| 4.9 MB 234 kB/s            
Collecting tensorboard-plugin-wit>=1.6.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/1a/c1/499e600ba0c618b451cd9c425ae1c177249940a2086316552fee7d86c954/tensorboard_plugin_wit-1.8.0-py3-none-any.whl (781 kB)
     |████████████████████████████████| 781 kB 108.0 MB/s            
Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.8/dist-packages (from tensorboard~=2.6->tensorflow) (2.0.1)
Collecting google-auth<3,>=1.6.3
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/6a/f7/06cbd5ebfba40a9d51df6217f9325317d824234400454aebcf014e2eee38/google_auth-2.3.3-py2.py3-none-any.whl (155 kB)
     |████████████████████████████████| 155 kB 123.4 MB/s            
Collecting rsa<5,>=3.1.4
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/30/ab/8fd9e88e6fa5ec41afca995938bbefb72195278e0cfc5bd76a4f29b23fb2/rsa-4.8-py3-none-any.whl (39 kB)
Collecting cachetools<5.0,>=2.0.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/ea/c1/4740af52db75e6dbdd57fc7e9478439815bbac549c1c05881be27d19a17d/cachetools-4.2.4-py3-none-any.whl (10 kB)
Collecting pyasn1-modules>=0.2.1
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/95/de/214830a981892a3e286c3794f41ae67a4495df1108c3da8a9f62159b9a9d/pyasn1_modules-0.2.8-py2.py3-none-any.whl (155 kB)
     |████████████████████████████████| 155 kB 133.6 MB/s            
Collecting requests-oauthlib>=0.7.0
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a3/12/b92740d845ab62ea4edf04d2f4164d82532b5a0b03836d4d4e71c6f3d379/requests_oauthlib-1.3.0-py2.py3-none-any.whl (23 kB)
Collecting importlib-metadata>=4.4
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/c4/1f/e2238896149df09953efcc53bdcc7d23597d6c53e428c30e572eda5ec6eb/importlib_metadata-4.8.2-py3-none-any.whl (17 kB)
Collecting zipp>=0.5
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/bd/df/d4a4974a3e3957fd1c1fa3082366d7fff6e428ddb55f074bf64876f8e8ad/zipp-3.6.0-py3-none-any.whl (5.3 kB)
Collecting pyasn1<0.5.0,>=0.4.6
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/62/1e/a94a8d635fa3ce4cfc7f506003548d0a2447ae76fd5ca53932970fe3053f/pyasn1-0.4.8-py2.py3-none-any.whl (77 kB)
     |████████████████████████████████| 77 kB 14.9 MB/s             
Requirement already satisfied: oauthlib>=3.0.0 in /usr/lib/python3/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard~=2.6->tensorflow) (3.1.0)
Building wheels for collected packages: termcolor
  Building wheel for termcolor (setup.py) ... done
  Created wheel for termcolor: filename=termcolor-1.1.0-py3-none-any.whl size=4830 sha256=4aeedeffb842458b87d0062ea9df11249edf340ce11b7c66be52242730f9adde
  Stored in directory: /root/.cache/pip/wheels/6c/f8/6e/368f686c1fd60dbd22adcdd8ec4225c33661f7510f34d01c20
Successfully built termcolor
Installing collected packages: pyasn1, zipp, rsa, pyasn1-modules, cachetools, requests-oauthlib, importlib-metadata, google-auth, tensorboard-plugin-wit, tensorboard-data-server, protobuf, markdown, grpcio, google-auth-oauthlib, absl-py, wrapt, typing-extensions, termcolor, tensorflow-io-gcs-filesystem, tensorflow-estimator, tensorboard, opt-einsum, libclang, keras-preprocessing, keras, h5py, google-pasta, gast, flatbuffers, astunparse, tensorflow
  Attempting uninstall: protobuf
    Found existing installation: protobuf 3.6.1
    Uninstalling protobuf-3.6.1:
      Successfully uninstalled protobuf-3.6.1
Successfully installed absl-py-1.0.0 astunparse-1.6.3 cachetools-4.2.4 flatbuffers-2.0 gast-0.4.0 google-auth-2.3.3 google-auth-oauthlib-0.4.6 google-pasta-0.2.0 grpcio-1.42.0 h5py-3.6.0 importlib-metadata-4.8.2 keras-2.7.0 keras-preprocessing-1.1.2 libclang-12.0.0 markdown-3.3.6 opt-einsum-3.3.0 protobuf-3.19.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 requests-oauthlib-1.3.0 rsa-4.8 tensorboard-2.7.0 tensorboard-data-server-0.6.1 tensorboard-plugin-wit-1.8.0 tensorflow-2.7.0 tensorflow-estimator-2.7.0 tensorflow-io-gcs-filesystem-0.22.0 termcolor-1.1.0 typing-extensions-4.0.0 wrapt-1.13.3 zipp-3.6.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
shiyanlou:project/ $ 

Conversation logs with Lanqiao Offical Team (Simplified Chinese)

@TalhaNaeem1
Copy link

TalhaNaeem1 commented Apr 22, 2022

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

@przemekpastuszka przemekpastuszka
How did you resolve this? I am facing issue with this, it is taking much time. Can you please share solution if you found any.

@przemekpastuszka

@gertvdijk
Copy link

gertvdijk commented Apr 24, 2022

@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

@TalhaNaeem1
Copy link

Well. Thank you @gertvdijk :)

joeyorlando added a commit to grafana/oncall that referenced this issue Dec 20, 2022
- swaps out `django-push-notifications` for
[`fcm-django`](https://github.com/grafana/fcm-django). Again.. this is a
fork of the parent repo for exactly the same reason.. the migrations
point to `auth_user` without letting us use our own user model, this has
been patched in the `grafana` fork. The reason why we are using
`fcm-django` vs `django-push-notifications` is that the latter does not
support the new FCM API, only the "legacy" API. The legacy FCM API does
not support certain push notification settings that we would like to
use.
- modifies the iOS/Android specific push notification settings
- adds a `flower` pod in the `docker-compose-developer.yml`, useful for
debugging tasks locally
- sets the mobile app verification token TTL to 5 minutes when
developing locally. The default of 1 minute makes working with device
emulators really tricky..

This PR also swaps out the base image in `engine/Dockerfile` from
`python:3.9-alpine3.16` to `python:3.9-slim-buster`.

As to why.. in short, with the introduction of the `fcm-django` library
there is now a peer-dependency on
[`grpcio`](https://github.com/grpc/grpc) (which is used by
`firebase_admin`.. which I am using in this PR to interact directly with
Firebase Cloud Messaging (FCM)). `grpcio` does not publish wheels (read:
compiled binaries) for the Alpine distro. It does publish wheels for
Debian and hence `pip install -r requirements.txt` does not need to
build this library from the source distribution.

This is a [known
"issue"](grpc/grpc#22815 (comment))
and the recommended solution in the community is to.. not use alpine.

These were the numbers, when building the image locally, in terms of
image size and build time:

| | Local image size (uncompressed | Build time (may differ based on
your network speed) |
| ------------------------- | -------------------------------------- |
---------- |
| `python:3.9-alpine3.16`   | 785MB  | 320s |
| `python:3.9-slim-buster` | 1.05GB  | 90s   |

Co-authored-by: Salvatore Giordano <salvatoregiordanoo@gmail.com>
@giuliohome
Copy link

On Fedora f37 with poetry install https://github.com/openai/chatgpt-retrieval-plugin it requires pip install grpcio==1.47.5 and it is very long because it is building it

chatgpt-retrieval-plugin-py3.11) [giulio@fedora chatgpt-retrieval-plugin]$ pip install --only-binary ":all:" grpcio==1.47.5
ERROR: Could not find a version that satisfies the requirement grpcio==1.47.5 (from versions: 1.49.0, 1.49.1, 1.50.0rc1, 1.50.0, 1.51.0rc1, 1.51.0, 1.51.1, 1.51.3, 1.52.0rc1, 1.52.0, 1.53.0rc2, 1.53.0)
ERROR: No matching distribution found for grpcio==1.47.5
(chatgpt-retrieval-plugin-py3.11) [giulio@fedora chatgpt-retrieval-plugin]$ pip install grpcio==1.47.5
Collecting grpcio==1.47.5
  Downloading grpcio-1.47.5.tar.gz (21.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 21.9/21.9 MB 2.7 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: six>=1.5.2 in /home/giulio/.cache/pypoetry/virtualenvs/chatgpt-retrieval-plugin-V1oUtLTb-py3.11/lib/python3.11/site-packages (from grpcio==1.47.5) (1.16.0)
Building wheels for collected packages: grpcio
  Building wheel for grpcio (setup.py) ... |

@gertvdijk
Copy link

@giuliohome Similar as my previous comment here with the links to pypi, it's pretty easy to see...

You're trying to install an older version which does not have Python 3.11 binaries. Just upgrade to one that has it if you require Python 3.11, or use a Python interpreter version 3.10.x (using pyenv or something like that).

1.47.5 only has cp310 wheels:

Screenshot_20230328_230434

1.53.0 has cp311 wheels:

Screenshot_20230328_230445

@giuliohome
Copy link

@gertvdijk thanks, yes I know, the problem is that Milvus is not yet ready for python 3.11 but I have solved using Redis (at least for now). OK, everything clarified and your screenshots (with explanation) are very helpful to visually confirm what was written in the logs.

@Zeck69
Copy link

Zeck69 commented Feb 29, 2024

I just tried to install in my machine with python 3.10 and the build took 35 mins... (mac M1, 16G RAM)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants