# PynqZ1 Installing Keras

**URL:** <https://discuss.pynq.io/t/pynqz1-installing-keras/1330>\
**Category:** Support\
**Created:** [June 7, 2020, 8:51pm UTC](https://discuss.pynq.io/t/pynqz1-installing-keras/1330 "2020-06-07T20:51:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![reynaldogonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/reynaldogonzalez/32/1183_2.png) [@reynaldogonzalez](https://discuss.pynq.io/u/reynaldogonzalez)\
**Post date:** [June 7, 2020, 8:51pm UTC](https://discuss.pynq.io/t/pynqz1-installing-keras/1330/1 "2020-06-07T20:51:12Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![cathalmccabe](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/cathalmccabe/32/3348_2.png) [@cathalmccabe](https://discuss.pynq.io/u/cathalmccabe)\
**Post date:** [June 8, 2020, 3:21pm UTC](https://discuss.pynq.io/t/pynqz1-installing-keras/1330/2 "2020-06-08T15:21:32Z")

</div>

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

> [@Installing Keras on PYNQ](https://discuss.pynq.io/t/installing-keras-on-pynq/340/4):
>
> If you expect someone to help, you should try to provide as much information as you can about your setup, the problem, what you have already tried, details about the problem(s) you encountered and any other relevant info. Cathal

> [@Tensorflow and Keras on Pynq Z1](https://discuss.pynq.io/t/tensorflow-and-keras-on-pynq-z1/305):
>
> Hi, is there anybody that successfully built Tensorflow and Keras libraries for Pynq Z1? Thank you.

Cathal

---

<div class="post-metadata">

**Author:** ![reynaldogonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/reynaldogonzalez/32/1183_2.png) [@reynaldogonzalez](https://discuss.pynq.io/u/reynaldogonzalez)\
**Post date:** [June 8, 2020, 6:11pm UTC](https://discuss.pynq.io/t/pynqz1-installing-keras/1330/3 "2020-06-08T18:11:23Z")

</div>

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](https://discuss.pynq.io/t/error-install-tensorflow/136)  
> 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](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](https://logictronix.com/wp-content/uploads/2019/04/TensorFlow_Installation_on_PYNQ_Nov_6_2018.pdf)  
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](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](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.

---

<div class="post-metadata">

**Author:** ![rock](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.pynq.io/rock/32/32_2.png) [@rock](https://discuss.pynq.io/u/rock)\
**Post date:** [June 11, 2020, 4:56am UTC](https://discuss.pynq.io/t/pynqz1-installing-keras/1330/4 "2020-06-11T04:56:08Z")

</div>

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.
