PynqZ1 Installing Keras

I am wondering if there is any way to install Keras on Pynq Z1.
I have seen some other posts but nothing that I could do successfully.
I was able to install tensorflow 0.11.0 but it does not contain Keras.

Any help?

1 Like

This has been asked before. Try a search of this forum.

Cathal

1 Like

Yes I have seen all the previous posts, I was hoping there might be some new information since its been about a year. Sorry for the lack of info.

I tried installing by the instructions on this post:

Error install Tensorflow
I managed to install tensorflow but only version 0.9.0 using:
wget https://github.com/samjabrahams/tensorflow-on-raspberry-pi/releases/download/v0.9.0/tensorflow-0.9.0-py3-none-any.whl
/usr/bin/python3 -m pip install tensorflow-0.9.0-py3-none-any.whl

I was able to install version 0.9.0 and version 0.11.0 using same instructions but neither of these versions have Keras.
(Does anyone know why the files ending with β€œnone-any.whl” work, but the files ending with β€œlinux-armv7l.whl” don’t work? Unfortunately, further releases didn’t have this ending.)

I also tried installing using these PDF instructions by logictronix:
TensorFlow Installation on PYNQ FPGA Board
It says by installing an older pynq image you can install tensorflow 1.1.0.

I tried following the tutorial by installing the 2016 image on the Pynq.
After installing the image, the python version is 3.4.3+
Next I tried to install the tensorflow 1.1.0 from samjabrahams github link,
but I got an error saying I need to upgrade pip,
and after upgrading I got an error saying I need Python 3.5

I downloaded Python 3.5 but got stuck on setting the alias to have pip3 run from python 3.5 instead of 3.4.

OUTPUT:
================================================================
root@pynq:/home/xilinx# pip3 install tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl
Processing ./tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl
Collecting numpy>=1.11.0 (from tensorflow==1.1.0)
Downloading https://files.pythonhosted.org/packages/01/1b/d3ddcabd5817be02df0e6ee20d64f77ff6d0d97f83b77f65e98c8a651981/numpy-1.18.5.zip (5.4MB
)
100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5.4MB 24kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File β€œβ€, line 1, in
File β€œ/tmp/pip-build-vczids2e/numpy/setup.py”, line 32, in
raise RuntimeError(β€œPython version >= 3.5 required.”)
RuntimeError: Python version >= 3.5 required.
----------------------------------------
Command β€œpython setup.py egg_info” failed with error code 1 in /tmp/pip-build-vczids2e/numpy/
You are using pip version 8.1.2, however version 20.1.1 is available.
You should consider upgrading via the β€˜pip install --upgrade pip’ command.
root@pynq:/home/xilinx# pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none
-any.whl (1.5MB)
100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1.5MB 81kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Successfully installed pip-20.1.1
root@pynq:/home/xilinx# pip3 install tensorflow-1.1.0-cp34-cp34m-linux_armv7l.whl
Traceback (most recent call last):
File β€œ/usr/local/bin/pip3”, line 7, in
from pip._internal.cli.main import main
File β€œ/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/main.py”, line 10, in
from pip._internal.cli.autocompletion import autocomplete
File β€œ/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/autocompletion.py”, line 9, in
from pip._internal.cli.main_parser import create_main_parser
File β€œ/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/main_parser.py”, line 7, in
from pip._internal.cli import cmdoptions
File β€œ/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/cmdoptions.py”, line 24, in
from pip._internal.cli.progress_bars import BAR_TYPES
File β€œ/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/progress_bars.py”, line 12, in
from pip._internal.utils.logging import get_indentation
File β€œ/usr/local/lib/python3.4/dist-packages/pip/_internal/utils/logging.py”, line 18, in
from pip._internal.utils.misc import ensure_dir
File β€œ/usr/local/lib/python3.4/dist-packages/pip/_internal/utils/misc.py”, line 20, in
from pip._vendor import pkg_resources
File β€œ/usr/local/lib/python3.4/dist-packages/pip/_vendor/pkg_resources/init.py”, line 92, in
raise RuntimeError(β€œPython 3.5 or later is required”)
RuntimeError: Python 3.5 or later is required
root@pynq:/home/xilinx# python3 --version
Python 3.4.3+
================================================================

Is it possible I can still install this tensorflow by changing default Python to 3.5?
I am still trying to figure out how the alias works, I tried changing it and messed up the links and had to re-image the pynq again.

Thank you for your help.

1 Like

I have tried to install tensorflow on arm/aarch64 images but found the compilation process very frustrating. The only success I had was to install tensorflow-lite on edge devices. For later versions of tensorflow (like 0.60+) you need bazel, while bootstrapping bazel itself requires you to use the same QEMU environment that we used to build the SD card image.

2 Likes