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?

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


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:
/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.

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 (5.4MB
100% |████████████████████████████████| 5.4MB 24kB/s
Complete output from command python egg_info:
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-build-vczids2e/numpy/”, line 32, in
raise RuntimeError(“Python version >= 3.5 required.”)
RuntimeError: Python version >= 3.5 required.
Command “python 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
-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/”, line 10, in
from pip._internal.cli.autocompletion import autocomplete
File “/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/”, line 9, in
from pip._internal.cli.main_parser import create_main_parser
File “/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/”, line 7, in
from pip._internal.cli import cmdoptions
File “/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/”, line 24, in
from pip._internal.cli.progress_bars import BAR_TYPES
File “/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/”, line 12, in
from pip._internal.utils.logging import get_indentation
File “/usr/local/lib/python3.4/dist-packages/pip/_internal/utils/”, line 18, in
from pip._internal.utils.misc import ensure_dir
File “/usr/local/lib/python3.4/dist-packages/pip/_internal/utils/”, line 20, in
from pip._vendor import pkg_resources
File “/usr/local/lib/python3.4/dist-packages/pip/_vendor/pkg_resources/”, 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.

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.

1 Like