arm32v7/python install numpy

  docker, pip, python

I’ve been trying to install numpy, pandas and scipy in a Docker image for an old Raspberry Pi 2B. The problem comes when pip tries to install them, it takes so much time (or even fails). The Dockerfile that I’ve been using is:

FROM arm32v7/python:3.7-slim-buster

# Keeps Python from generating .pyc files in the container

# Turns off buffering for easier container logging

# Install pip requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Workdir

# Switching to a non-root user
RUN useradd appuser && chown -R appuser /book
USER appuser

# During debugging, this entry point will be overridden.
CMD [ "jupyter", "notebook", "--no-mathjax", "--no-browser", "--port", "4000"]

I’ve tried to intall some libraries like build-essentials, gcc, etc… but it didn’t work…
Installing those packages in the OS (Raspberry Pi OS Lite) is quite fast because pip makes use of the armhf packages. Another option I tried was to use raspbian/stretch, but it comes with Python 3.5 and scipy needs Python => 3.7. And installing a major version of Python makes the container too big (1GB more or less)…

So, is there any way to deal with the pip install issue?

Thank you so much!

Source: Docker Questions