title: Cannot build python image – failure at pip install requirements
body: <p>With the following code in <code>Dockerfile</code>:</p>
  <pre><code>FROM python:3.8-alpine
  
  WORKDIR /app
  
  COPY requirements.txt .
  
  RUN python3 -m pip install --upgrade pip
  
  RUN pip3 install -r requirements.txt
  
  RUN python3 -m spacy download en_core_web_sm
  
  EXPOSE 80
  
  CMD [ &quot;python3&quot;, &quot;main.py&quot; ]
  </code></pre>
  <p>And the following in <code>requirements.txt</code>:</p>
  <pre><code>Flask==2.0.2
  openai==0.13.0
  spacy==3.2.1
  stripe==2.65.0
  </code></pre>
  <p>The image build fails at <code>RUN pip3 install -r requirements.txt</code> with the following log. I noticed there are several lines stating <code>error: command 'gcc' failed: No such file or directory</code> while trying to build wheels.</p>
  <pre class="lang-none prettyprint-override"><code> &gt; [5/6] RUN pip3 install -r requirements.txt:                                                                                                                           
  #9 4.488 Collecting Flask==2.0.2
  #9 5.404   Downloading Flask-2.0.2-py3-none-any.whl (95 kB)
  #9 5.813      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 95.2/95.2 KB 379.1 kB/s eta 0:00:00
  #9 6.278 Collecting openai==0.13.0
  #9 6.419   Downloading openai-0.13.0.tar.gz (37 kB)
  #9 6.614   Preparing metadata (setup.py): started
  #9 8.361   Preparing metadata (setup.py): finished with status 'done'
  #9 9.383 Collecting spacy==3.2.1
  #9 9.533   Downloading spacy-3.2.1.tar.gz (1.1 MB)
  #9 15.19      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 188.2 kB/s eta 0:00:00
  #9 18.18   Installing build dependencies: started
  #9 140.2   Installing build dependencies: still running...
  #9 160.1   Installing build dependencies: finished with status 'error'
  #9 160.2   error: subprocess-exited-with-error
  #9 160.2   
  #9 160.2   × pip subprocess to install build dependencies did not run successfully.
  #9 160.2   │ exit code: 1
  #9 160.2   ╰─&gt; [98 lines of output]
  #9 160.2       Collecting setuptools
  #9 160.2         Downloading setuptools-60.6.0-py3-none-any.whl (953 kB)
  #9 160.2            ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 953.8/953.8 KB 748.5 kB/s eta 0:00:00
  #9 160.2       Collecting cython&lt;3.0,&gt;=0.25
  #9 160.2         Downloading Cython-0.29.27-cp38-cp38-musllinux_1_1_x86_64.whl (2.1 MB)
  #9 160.2            ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 356.0 kB/s eta 0:00:00
  #9 160.2       Collecting cymem&lt;2.1.0,&gt;=2.0.2
  #9 160.2         Downloading cymem-2.0.6.tar.gz (8.2 kB)
  #9 160.2         Installing build dependencies: started
  #9 160.2         Installing build dependencies: finished with status 'done'
  #9 160.2         Getting requirements to build wheel: started
  #9 160.2         Getting requirements to build wheel: finished with status 'done'
  #9 160.2         Installing backend dependencies: started
  #9 160.2         Installing backend dependencies: finished with status 'done'
  #9 160.2         Preparing metadata (pyproject.toml): started
  #9 160.2         Preparing metadata (pyproject.toml): finished with status 'done'
  #9 160.2       Collecting preshed&lt;3.1.0,&gt;=3.0.2
  #9 160.2         Downloading preshed-3.0.6.tar.gz (14 kB)
  #9 160.2         Installing build dependencies: started
  #9 160.2         Installing build dependencies: still running...
  #9 160.2         Installing build dependencies: finished with status 'error'
  #9 160.2         error: subprocess-exited-with-error
  #9 160.2       
  #9 160.2         × pip subprocess to install build dependencies did not run successfully.
  #9 160.2         │ exit code: 1
  #9 160.2         ╰─&gt; [62 lines of output]
  #9 160.2             Collecting setuptools
  #9 160.2               Using cached setuptools-60.6.0-py3-none-any.whl (953 kB)
  #9 160.2             Collecting cython&gt;=0.28
  #9 160.2               Using cached Cython-0.29.27-cp38-cp38-musllinux_1_1_x86_64.whl (2.1 MB)
  #9 160.2             Collecting cymem&lt;2.1.0,&gt;=2.0.2
  #9 160.2               Using cached cymem-2.0.6.tar.gz (8.2 kB)
  #9 160.2               Installing build dependencies: started
  #9 160.2               Installing build dependencies: finished with status 'done'
  #9 160.2               Getting requirements to build wheel: started
  #9 160.2               Getting requirements to build wheel: finished with status 'done'
  #9 160.2               Installing backend dependencies: started
  #9 160.2               Installing backend dependencies: finished with status 'done'
  #9 160.2               Preparing metadata (pyproject.toml): started
  #9 160.2               Preparing metadata (pyproject.toml): finished with status 'done'
  #9 160.2             Collecting murmurhash&lt;1.1.0,&gt;=0.28.0
  #9 160.2               Downloading murmurhash-1.0.6.tar.gz (12 kB)
  #9 160.2               Installing build dependencies: started
  #9 160.2               Installing build dependencies: finished with status 'done'
  #9 160.2               Getting requirements to build wheel: started
  #9 160.2               Getting requirements to build wheel: finished with status 'done'
  #9 160.2               Installing backend dependencies: started
  #9 160.2               Installing backend dependencies: finished with status 'done'
  #9 160.2               Preparing metadata (pyproject.toml): started
  #9 160.2               Preparing metadata (pyproject.toml): finished with status 'done'
  #9 160.2             Building wheels for collected packages: cymem, murmurhash
  #9 160.2               Building wheel for cymem (pyproject.toml): started
  #9 160.2               Building wheel for cymem (pyproject.toml): finished with status 'error'
  #9 160.2               error: subprocess-exited-with-error
  #9 160.2       
  #9 160.2               × Building wheel for cymem (pyproject.toml) did not run successfully.
  #9 160.2               │ exit code: 1
  #9 160.2               ╰─&gt; [7 lines of output]
  #9 160.2                   running bdist_wheel
  #9 160.2                   running build
  #9 160.2                   running build_py
  #9 160.2                   package init file 'cymem/tests/__init__.py' not found (or not a regular file)
  #9 160.2                   running build_ext
  #9 160.2                   building 'cymem.cymem' extension
  #9 160.2                   error: command 'gcc' failed: No such file or directory
  #9 160.2                   [end of output]
  #9 160.2       
  #9 160.2               note: This error originates from a subprocess, and is likely not a problem with pip.
  #9 160.2               ERROR: Failed building wheel for cymem
  #9 160.2               Building wheel for murmurhash (pyproject.toml): started
  #9 160.2               Building wheel for murmurhash (pyproject.toml): finished with status 'error'
  #9 160.2               error: subprocess-exited-with-error
  #9 160.2       
  #9 160.2               × Building wheel for murmurhash (pyproject.toml) did not run successfully.
  #9 160.2               │ exit code: 1
  #9 160.2               ╰─&gt; [6 lines of output]
  #9 160.2                   running bdist_wheel
  #9 160.2                   running build
  #9 160.2                   running build_py
  #9 160.2                   running build_ext
  #9 160.2                   building 'murmurhash.mrmr' extension
  #9 160.2                   error: command 'gcc' failed: No such file or directory
  #9 160.2                   [end of output]
  #9 160.2       
  #9 160.2               note: This error originates from a subprocess, and is likely not a problem with pip.
  #9 160.2               ERROR: Failed building wheel for murmurhash
  #9 160.2             Failed to build cymem murmurhash
  #9 160.2             ERROR: Could not build wheels for cymem, murmurhash, which is required to install pyproject.toml-based projects
  #9 160.2             [end of output]
  #9 160.2       
  #9 160.2         note: This error originates from a subprocess, and is likely not a problem with pip.
  #9 160.2       error: subprocess-exited-with-error
  #9 160.2       
  #9 160.2       × pip subprocess to install build dependencies did not run successfully.
  #9 160.2       │ exit code: 1
  #9 160.2       ╰─&gt; See above for output.
  #9 160.2       
  #9 160.2       note: This error originates from a subprocess, and is likely not a problem with pip.
  #9 160.2       [end of output]
  #9 160.2   
  #9 160.2   note: This error originates from a subprocess, and is likely not a problem with pip.
  #9 160.2 error: subprocess-exited-with-error
  #9 160.2 
  #9 160.2 × pip subprocess to install build dependencies did not run successfully.
  #9 160.2 │ exit code: 1
  #9 160.2 ╰─&gt; See above for output.
  #9 160.2 
  #9 160.2 note: This error originates from a subprocess, and is likely not a problem with pip.
  ------
  executor failed running [/bin/sh -c pip3 install -r requirements.txt]: exit code: 1
  </code></pre>
  <p><strong>UPDATE</strong>: after adding <code>RUN apk add gcc</code> before running <code>pip</code>, I now get a different error at wheel-building:</p>
  <pre><code>#10 154.1               × Building wheel for murmurhash (pyproject.toml) did not run successfully.
  #10 154.1               │ exit code: 1
  #10 154.1               ╰─&gt; [8 lines of output]
  #10 154.1                   running bdist_wheel
  #10 154.1                   running build
  #10 154.1                   running build_py
  #10 154.1                   running build_ext
  #10 154.1                   building 'murmurhash.mrmr' extension
  #10 154.1                   gcc: fatal error: cannot execute 'cc1plus': execvp: No such file or directory
  #10 154.1                   compilation terminated.
  #10 154.1                   error: command '/usr/bin/gcc' failed with exit code 1
  #10 154.1                   [end of output]
  </code></pre>