Failed building wheel for grpcio - docker-compose. Python project

1.7k Views Asked by At

Try to build docker-compose container on host machine. The problem with grpcio, which fails all the time. Error:

distutils.errors.CompileError: command '/usr/bin/gcc' failed with exit code 1
ERROR: Failed building wheel for grpcio

With VERY big traceback

Interesting that on my laptop there are no any problems with it. Container works well.

I have tried (language - Python):

  • Upgrade pip to latest version - no results
  • Downgrade pip setuptools to 46.0.0 version - no results.

Dockerfile:

FROM python:3.9.4-alpine

WORKDIR /usr/src/project

# Create the app user
RUN addgroup -S project && adduser -S project -G project

ENV HOME=/home
ENV APP_HOME=/home/api
RUN mkdir $APP_HOME
RUN mkdir $APP_HOME/static
RUN mkdir $APP_HOME/media
WORKDIR $APP_HOME

RUN chown -R project:project $APP_HOME

RUN apk add --update --no-cache tiff-dev jpeg-dev openjpeg-dev zlib-dev freetype-dev lcms2-dev \
libwebp-dev tcl-dev tk-dev harfbuzz-dev fribidi-dev libimagequant-dev libxcb-dev libpng-dev \
gcc build-base freetype-dev libpng-dev openblas-dev \
postgresql-dev gcc python3-dev musl-dev

RUN pip3 install --upgrade pip
RUN pip3 install setuptools==49.6.0
COPY requirements.txt ./
RUN pip3 install -r requirements.txt

COPY . .
1

There are 1 best solutions below

0
On BEST ANSWER

I still dont know how to fix this error. But i have found the solution for this situation. I build doker image on local machine, push it to docker hub. On host machine, pulled from docker and changed docker-compose.yml file to use existing image instead of build new one. Technically problem solved, but it`s still curious why i got this error.

Edited reinstall OS on host machine. Now its Ubuntu 20.04. No problem anymore