From 3c12bcd45b652288d0c31f43cf13cc0cd85def9f Mon Sep 17 00:00:00 2001 From: Piero Macaluso Date: Thu, 3 Sep 2020 17:26:00 +0200 Subject: [PATCH 1/2] Added `Dockerfile.bullseye` and related section in `README.md` --- README.md | 13 ++++++++++++- build_tensorflow/Dockerfile.bullseye | 29 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 build_tensorflow/Dockerfile.bullseye diff --git a/README.md b/README.md index fd8d848..d61c4e3 100644 --- a/README.md +++ b/README.md @@ -47,13 +47,24 @@ apt-get install libpython-all-dev:armhf # For python3 apt-get install libpython3-all-dev:armhf ``` -Using Docker +### Using Docker + +#### Python 3.7 + ```shell cd build_tensorflow/ docker build -t tf-arm -f Dockerfile . docker run -it -v /tmp/tensorflow_pkg/:/tmp/tensorflow_pkg/ --env TF_PYTHON_VERSION=3.7 tf-arm ./build_tensorflow.sh configs/ # rpi.conf, rk3399.conf ... ``` +#### Python 3.8 + +```shell +cd build_tensorflow/ +docker build -t tf-arm -f Dockerfile.bullseye . +docker run -it -v /tmp/tensorflow_pkg/:/tmp/tensorflow_pkg/ --env TF_PYTHON_VERSION=3.8 tf-arm ./build_tensorflow.sh configs/ # rpi.conf, rk3399.conf ... +``` + ## Edit tweaks like Bazel resources, board model, and others. See configuration file examples in: build_tensorflow/configs/ diff --git a/build_tensorflow/Dockerfile.bullseye b/build_tensorflow/Dockerfile.bullseye new file mode 100644 index 0000000..fcb7e7e --- /dev/null +++ b/build_tensorflow/Dockerfile.bullseye @@ -0,0 +1,29 @@ +FROM debian:bullseye + +RUN dpkg --add-architecture armhf && dpkg --add-architecture arm64 \ + && apt-get update && apt-get install -y \ + openjdk-11-jdk automake autoconf libpng-dev \ + curl zip unzip libtool swig zlib1g-dev pkg-config git wget xz-utils \ + python3-numpy python3-pip python3-mock \ + libpython3-dev libpython3-all-dev \ + libpython3-dev:armhf libpython3-all-dev:armhf \ + libpython3-dev:arm64 libpython3-all-dev:arm64 + +# NOTE: forcing gcc 8.3 as default (prevents internal compiler error: in emit_move_insn, at expr.c bug in gcc-6 of stretch) +RUN echo "deb http://ftp.us.debian.org/debian/ buster main contrib non-free" > /etc/apt/sources.list.d/buster.list \ + && apt-get update && apt-get install -y --allow-downgrades gcc-8 g++-8 gcc=4:8.3.0-1 g++=4:8.3.0-1 cpp=4:8.3.0-1\ + && rm -f /etc/apt/sources.list.d/buster.list \ + && rm -rf /var/lib/apt/lists/* + +RUN pip3 install -U --user keras_applications==1.0.8 --no-deps \ + && pip3 install -U --user keras_preprocessing==1.1.0 --no-deps \ + && ldconfig + +RUN /bin/bash -c "update-alternatives --install /usr/bin/python python /usr/bin/python3 150" + +WORKDIR /root +RUN git clone https://github.com/lhelontra/tensorflow-on-arm/ + +WORKDIR /root/tensorflow-on-arm/build_tensorflow/ +RUN git checkout v2.3.0 +CMD ["/bin/bash"] From f32736b79c61588296065d4905fd4b16741684c4 Mon Sep 17 00:00:00 2001 From: pieromacaluso Date: Fri, 4 Sep 2020 17:11:24 +0200 Subject: [PATCH 2/2] Update `Dockerfile.bullseye` Fixed compilation of TF 2.3.0 with Python3.8 --- build_tensorflow/Dockerfile.bullseye | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build_tensorflow/Dockerfile.bullseye b/build_tensorflow/Dockerfile.bullseye index fcb7e7e..6940a5f 100644 --- a/build_tensorflow/Dockerfile.bullseye +++ b/build_tensorflow/Dockerfile.bullseye @@ -4,11 +4,13 @@ RUN dpkg --add-architecture armhf && dpkg --add-architecture arm64 \ && apt-get update && apt-get install -y \ openjdk-11-jdk automake autoconf libpng-dev \ curl zip unzip libtool swig zlib1g-dev pkg-config git wget xz-utils \ - python3-numpy python3-pip python3-mock \ + python3-pip python3-mock \ libpython3-dev libpython3-all-dev \ libpython3-dev:armhf libpython3-all-dev:armhf \ libpython3-dev:arm64 libpython3-all-dev:arm64 +RUN pip install "numpy<1.19.0" + # NOTE: forcing gcc 8.3 as default (prevents internal compiler error: in emit_move_insn, at expr.c bug in gcc-6 of stretch) RUN echo "deb http://ftp.us.debian.org/debian/ buster main contrib non-free" > /etc/apt/sources.list.d/buster.list \ && apt-get update && apt-get install -y --allow-downgrades gcc-8 g++-8 gcc=4:8.3.0-1 g++=4:8.3.0-1 cpp=4:8.3.0-1\