I have a Raspberry Pi 3B+ running Raspbian Buster. I am running a deep-learning app that uses tensorflow-lite runtime and other modules like pillow, numpy and matplotlib. I have been trying to build a docker container to distribute the app. I am finding it very challenging to build an image from Dockerfile with the required libraries and after having spent the weekend experimenting with different base images and researching the issue made little progress.
Here are the contents of Dockerfile:
FROM python:3.7
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . /app
## There is more after this
## to install tensorflow-lite runtime
## from copied-over .whl file.
## I have it left out
## as I have yet to progress beyond this point.
I get: ERROR: No matching distribution found for numpy==1.16.2
Here is my requirements manifest:
numpy==1.16.2
paho-mqtt==1.5.1
picamera==1.13
Pillow==5.4.1
scipy==1.1.0
matplotlib==3.0.2
I got these specific versions from pip freeze > requirements.txt
on the Pi where the app is working.
What I have tried:
docker pull ellerbach/tensor_pillow_flask
) and trying to use it as the base image.Still no progress. Appreciate your help. The full text of the error message is:
Step 4/5 : RUN pip install -r requirements.txt
---> Running in 6bee0e112272
Collecting numpy==1.16.2
Downloading numpy-1.16.2.zip (5.1 MB)
[91m ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o8ypxup1/numpy_0ed49f4dc38649d790838c7f052a364a/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o8ypxup1/numpy_0ed49f4dc38649d790838c7f052a364a/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-tax52vej
cwd: /tmp/pip-install-o8ypxup1/numpy_0ed49f4dc38649d790838c7f052a364a/
Complete output (4 lines):
running egg_info
creating /tmp/pip-pip-egg-info-tax52vej/numpy.egg-info
Running from numpy source directory.
error: [Errno 1] Operation not permitted
----------------------------------------
[0m[91mWARNING: Discarding https://files.pythonhosted.org/packages/cf/8d/6345b4f32b37945fedc1e027e83970005fc9c699068d2f566b82826515f2/numpy-1.16.2.zip#sha256=6c692e3879dde0b67a9dc78f9bfb6f61c666b4562fd8619632d7043fb5b691b0 (from https://pypi.org/simple/numpy/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[0m[91mERROR: Could not find a version that satisfies the requirement numpy==1.16.2 (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0rc1, 1.13.0rc2, 1.13.0, 1.13.1, 1.13.3, 1.14.0rc1, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0rc1, 1.16.0rc2, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0rc1, 1.17.0rc2, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0rc1, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0rc1, 1.19.0rc2, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0rc1, 1.20.0rc2, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0rc1, 1.21.0rc2, 1.21.0, 1.21.1, 1.21.2, 1.21.3, 1.21.4)
[0m[91mERROR: No matching distribution found for numpy==1.16.2
[0m[91mWARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
[0m
Got this working through a trial-and-error process with different base images until I found one that works. This did the job:
FROM arm32v7/python:3.7.10-buster
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . /app
The requirements manifest has:
numpy==1.16.2
paho-mqtt==1.5.1
picamera==1.13
Pillow==5.4.1
scipy==1.1.0
matplotlib==3.0.2
To install tensorflow-lite runtime, I used pip installer inside docker container with a local copy of the '.whl' file from Google. I included this file in the app folder that is copied over per the Dockerfile. Now I have a docker container with all pre-requisites satisfied.
Thank you for your time and suggestions.