1

With the following docker file,

FROM python:3.9-slim-buster

WORKDIR /python-docker

COPY requirements.txt requirements.txt

RUN python3 -m pip install --upgrade pip

RUN pip3 install -r requirements.txt

COPY . .

EXPOSE 5000

CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]

requirement file as follows,

boto3==1.21.32
Flask==2.2.2
Flask_Cors==3.0.10
hvac==1.0.2
PyJWT==2.6.0
PyMySQL==0.10.1
zenpy==2.0.24
gunicorn==20.1.0
pandas==1.4.2

When I tried building multi arc docker file with following command, docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t name/flask-docker:latest --push .

It displays the following output:

× pip subprocess to install build dependencies did not run successfully.
#0 148.6   │ exit code: 1
#0 148.6   ╰─> [262 lines of output]
#0 148.6       Collecting setuptools>=51.0.0
#0 148.6         Downloading setuptools-65.6.0-py3-none-any.whl (1.2 MB)
#0 148.6            ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 7.0 MB/s eta 0:00:00
#0 148.6       Collecting wheel
#0 148.6         Downloading wheel-0.38.4-py3-none-any.whl (36 kB)
#0 148.6       Collecting Cython<3,>=0.29.24
#0 148.6         Downloading Cython-0.29.32-py2.py3-none-any.whl (986 kB)
#0 148.6            ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 986.3/986.3 kB 9.1 MB/s eta 0:00:00
#0 148.6       Collecting oldest-supported-numpy>=0.10
#0 148.6         Downloading oldest_supported_numpy-2022.11.19-py3-none-any.whl (4.9 kB)
#0 148.6       Collecting numpy==1.19.3
#0 148.6         Downloading numpy-1.19.3.zip (7.3 MB)
#0 148.6            ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.3/7.3 MB 13.4 MB/s eta 0:00:00
#0 148.6         Installing build dependencies: started
#0 148.6         Installing build dependencies: finished with status 'done'
#0 148.6         Getting requirements to build wheel: started
#0 148.6         Getting requirements to build wheel: finished with status 'done'
#0 148.6         Preparing metadata (pyproject.toml): started
#0 148.6         Preparing metadata (pyproject.toml): still running...
#0 148.6         Preparing metadata (pyproject.toml): finished with status 'error'
#0 148.6         error: subprocess-exited-with-error
#0 148.6       
#0 148.6         × Preparing metadata (pyproject.toml) did not run successfully.
#0 148.6         │ exit code: 1
#0 148.6         ╰─> [227 lines of output]
#0 148.6             Running from numpy source directory.
#0 148.6             setup.py:480: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
#0 148.6               run_build = parse_setuppy_commands()
#0 148.6             Processing numpy/random/_bounded_integers.pxd.in
#0 148.6             Processing numpy/random/_common.pyx
#0 148.6             Processing numpy/random/_mt19937.pyx
#0 148.6             Processing numpy/random/_philox.pyx
#0 148.6             Processing numpy/random/mtrand.pyx
#0 148.6             Processing numpy/random/bit_generator.pyx


RuntimeError: Broken toolchain: cannot link a simple C program
#0 148.6             [end of output]
#0 148.6       
#0 148.6         note: This error originates from a subprocess, and is likely not a problem with pip.
#0 148.6       error: metadata-generation-failed
#0 148.6       
#0 148.6       × Encountered error while generating package metadata.
#0 148.6       ╰─> See above for output.
#0 148.6       
#0 148.6       note: This is an issue with the package mentioned above, not pip.
#0 148.6       hint: See above for details.
#0 148.6       [end of output]
#0 148.6   
#0 148.6   note: This error originates from a subprocess, and is likely not a problem with pip.
#0 148.6 error: subprocess-exited-with-error
#0 148.6 
#0 148.6 × pip subprocess to install build dependencies did not run successfully.
#0 148.6 │ exit code: 1
#0 148.6 ╰─> See above for output.
#0 148.6 
#0 148.6 note: This error originates from a subprocess, and is likely not a problem with pip.
------
Dockerfile:9
--------------------
   7 |     RUN python3 -m pip install --upgrade pip
   8 |     
   9 | >>> RUN pip3 install -r requirements.txt

As the above issue says it is not problem with pip , couldn't exactly get whether it is the problem with any of the underlying packages or not?

Note: I tried removing pandas from requirement file and it is working , but I need that as I have an import based on that.

My Car
  • 4,198
  • 5
  • 17
  • 50
Ananthan
  • 37
  • 1
  • 6

1 Answers1

0

ok man just try to install packages one by one or you can remove the version in front of every package so it will automatically adjust just like this

boto3
Flask
Flask_Cors
hvac
PyJWT
PyMySQL
zenpy
gunicorn
pandas```
#I think it will work fine
baibars313
  • 17
  • 3