Takes long time while building image on python wit messaage : Building wheel for pandas (pyproject.toml): still running

Question:

i have problem while building docker image on python :
below execution process takes long time around 20 minutes:

Building wheel for pandas (pyproject.toml): still running...
Building wheel for pandas (pyproject.toml): still running...
Building wheel for pandas (pyproject.toml): still running...
Building wheel for pandas (pyproject.toml): still running...
Building wheel for pandas (pyproject.toml): still running...

Dockerfile:

FROM python:3.11.2-buster
WORKDIR /app
COPY . .
RUN pip install -r /app/requirements.txt
CMD ["uvicorn", "main:app", "--host=0.0.0.0", "--port=80"]

requirement.txt:

fastapi
uvicorn
pydantic[dotenv]
requests
python-dotenv==0.19.2
pandas==1.4.3
numpy==1.24.2
scikit-learn==1.2.2

Answers:

There is no building wheel for Pandas==1.4.3 and Python==3.11 so the fallback is to download the source archive (pandas-1.4.3.tar.gz) and build it from scratch. You have 2 options:

  1. Downgrade your python version from 3.11 to 3.10 in Dockerfile:
FROM python:3.10.10-buster
  1. Upgrade the pandas version from 1.4.3 to 1.5.3 in requirements.txt:
pandas==1.5.3

In both cases (Python 3.10, Pandas 1.4) or (Python 3.11, Pandas 1.5), there is no compilation time with your requirements.

Answered By: Corralien
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.