pip install google-cloud-pubsub fails install in docker container

前端 未结 3 839
南旧
南旧 2021-01-28 00:35

I am trying to use a pupsub emulator. It starts but when I try to use my python script I get the following error

ModuleNotFoundError: No module named \'google\'
         


        
3条回答
  •  暖寄归人
    2021-01-28 01:25

    If you look at the downloadable files for grpcio, the problem package, you'll see that there are precompiled binary wheels:

    https://pypi.org/project/grpcio/#files

    So why is this build trying to compile from scratch? Because you're using Alpine. Alpine doesn't support binary wheels (see https://pythonspeed.com/articles/alpine-docker-python/ for longer explanation).

    As others say, you can install a compiler... or you can just stop using an Alpine-based Docker image, and then you will be able to use precompiled wheels, and your builds will be faster. And your images will also be smaller since you won't need to install a compiler (you can make Alpine images smaller wiht multi-stage builds, but that's more work).

提交回复
热议问题