简体   繁体   中英

arm32v7/python install numpy

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!

Update:

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM