Reputation: 163
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
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Install pip requirements
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Workdir
WORKDIR /book
# 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!
The problem was that pip was not searching in: https://piwheels.org/simple for already compiled versions of the packages. So the solution was just to add:
RUN pip install --index-url=https://www.piwheels.org/simple --no-cache-dir -r requirements.txt
Upvotes: 4
Views: 2306
Reputation: 163
The problem was that pip was not searching in: https://piwheels.org/simple for already compiled versions of the packages. So the solution was just to add:
RUN pip install --index-url=https://www.piwheels.org/simple --no-cache-dir -r requirements.txt
Upvotes: 7