Can't install Tensorflow 2.3 on Raspberry Pi 4 - python

I can't currently install TensorFlow 2.3 on a Raspberry Pi 4.
Unfortunately, the pip doesn't return any TensorFlow version:
pip install tensorflow==
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement tensorflow==
ERROR: No matching distribution found for tensorflow==
I read somewhere that TensorFlow only supports the 64-bit version of Python and only the versions between 3.5 to 3.8 so I made sure that I have these versions installed as well.
The current Linux distro that I have is the following aarch64.
pip and python have the following versions:
pip -V python
pip 20.3.1 from /home/pi/envs/awe/lib/python3.7/site-packages/pip (python 3.7)
python -V
Python 3.7.3
And I also have a 64-bit version of Python:
platform.architecture()
('64bit', 'ELF')
Why can't pip find a compatible TensorFlow of version 2.3?

For the Raspberry Pi 4 ARM64 platform TensorFlow is not available as pre-built version for pip and must be compiled manually.
Follow these instructions and cross compile it on a different more powerful environment, not on the Pi 4. The instructions are not up to date anymore, I have completed them here. These are the steps to cross compile TensorFlow 2.3.1 on an Ubuntu Linux:
git clone git#github.com:tensorflow/tensorflow.git
cd tensorflow
The old version 2.3.1 does not know Python 3.8. When using Python 3.7 then this might not be necessary.
wget https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/ci_build/Dockerfile.pi-python38 -o tensorflow/tools/ci_build/Dockerfile.pi-python38
CMake is now also required, I'm using here the master branch, which is corresponding to version 2.5.0 (in case this does not work anymore in the future with the master version):
wget -O tensorflow/tools/ci_build/install/install_cmake.sh https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/tools/ci_build/install/install_cmake.sh
chmod +x tensorflow/tools/ci_build/install/install_cmake.sh
To support Python 3.8 add support for it, again taken from the master branch (version 2.5.0):
wget -O tensorflow/tools/ci_build/install/install_pi_python3x_toolchain.sh https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/tools/ci_build/install/install_pi_python3x_toolchain.sh
chmod +x tensorflow/tools/ci_build/install/install_pi_python3x_toolchain.sh
You also need these files for the build:
wget -O tensorflow/tools/ci_build/pi/build_raspberry_pi.sh https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
chmod +x tensorflow/tools/ci_build/pi/build_raspberry_pi.sh
There is an issue with newer numpy version. Use this cherry-pick from git:
git cherry-pick 75ea0b31477d6ba9e990e296bbbd8ca4e7eebadf
Now finally all can be compiled. This takes several hours most likely.
tensorflow/tools/ci_build/ci_build.sh PI-PYTHON38 tensorflow/tools/ci_build/pi/build_raspberry_pi.sh AARCH64
If something fails and some files have to be patched or added keep in mind to clean the Docker container to prevent using the Docker cache when restarting the build process. docker images, docker rmi <imageid> and docker rm <container> are your friends.

Related

M1 Mac Tensorflow VS Code Rosetta2

I'm struggling to install tensorflow with a M1 mac. I've got python 3.9.7 and Monterrey 12.3 and apple silicon visual studio code. There is an apple solution involving miniconda apple dependancies and tensorflow-macos and tensorflow-metal. However this solution is not good for me as I have to use Rosetta2 emulator for multiple packages including PyQt5 etc. I was wondering if anyone has been able to use their M1 macs and pip installed tensorflow in a venv rosetta terminal. Thank you.
Kevin
Running TensorFlow on miniforge + conda-forge (arm64)
TensorFlow can run natively on M1 (arm64) macs. A highly recommended, easy way to install TensorFlow on arm64 macs is to via conda-forge. You should install python via miniforge or miniconda, because there is an arm64 (Apple Sillicon) distribution. With this, as of today, you can install the latest version 2.10.0 of TensorFlow:
$ lipo -archs $(which python3) # python3 is running natively as arm64
arm64
$ conda install -c conda-forge tensorflow
Note: tensorflow-macos 2.4.0 is obsolete so you shouldn't be using that.
But still want Rosetta 2? Try conda-forge.
If you really need to have python running on Rosetta 2 (x86_64) in cases where some packages does not support arm64,
you can still install TensorFlow with a macOS x86_64 release via conda. Installing via pip and PyPI repository won't work here, because you will run into Illegal hardware instruction segfault because Google's official TF macos-x86_64 wheel releases on PyPI assumes a target platform that has AVX instructions.
$ lipo -archs $(which python3) # x86_64 means Rosetta 2
x86_64
$ conda install -c conda-forge tensorflow # install via conda
$ python -c 'import tensorflow; print(tensorflow.__version__)'

Could not find a version that satisfies the requirement mediapipe

Environment: Debian, Debian GNU/Linux, 10 (buster), amd64 built on 20210609, supports Shielded VM features.
Platform: Google cloud compute engine
Python version: Python 3.7.3
pip3 version: pip 18.1
command: pip3 install mediapipe
result:
Collecting mediapipe
Could not find a version that satisfies the requirement mediapipe (from versions: )
No matching distribution found for mediapipe
I have also tried to install it by downloading .whl file of it
command: pip3 install mediapipe-0.8.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
respose:
mediapipe-0.8.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl is not a supported wheel on this platform.
It seems that mediapipe has some Incompatibilities found with python > 3.7.0. There are issues with python 3.9+, or with python 32-bit (rather than 64)
My suggestion is to downgrade python version to 3.6 using conda. We will create a python environment with the suggested version 3.6:
$ sudo apt install wget
$ wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
$ chmod +x Anaconda3-2021.05-Linux-x86_64.sh
$ ./Anaconda3-2021.05-Linux-x86_64.sh
$ conda install python=3.6
$ conda create --name py36 python=3.6
$ conda activate py36
$ pip install mediapipe
There are multiples ways to solve this, but I have reproduced in your exactly same environment and it works.
You need to install 64-bit python. just uninstall the 32bit python and install
64-bit version of python from:
https://www.python.org/downloads/
Maker sure to check the "Add to PATH" checkbox during installation.
After installing, you can run pip command and mediapipe will be installed smoothly.
pip install mediapipe

No matching distribution found for tensorflow" even though I meet the requirements [duplicate]

I installed the latest version of Python (3.6.4 64-bit) and the latest version of PyCharm (2017.3.3 64-bit). Then I installed some modules in PyCharm (Numpy, Pandas, etc), but when I tried installing Tensorflow it didn't install, and I got the error message:
Could not find a version that satisfies the requirement TensorFlow (from versions: )
No matching distribution found for TensorFlow.
Then I tried installing TensorFlow from the command prompt and I got the same error message.
I did however successfully install tflearn.
I also installed Python 2.7, but I got the same error message again. I googled the error and tried some of the things which were suggested to other people, but nothing worked (this included installing Flask).
How can I install Tensorflow? Thanks.
The latest requirements for running TensorFlow are documented in the installation documentation.
TensorFlow only supports 64-bit Python
TensorFlow only supports certain versions of Python (for example, Python 3.6 is not supported)
So, if you're using an out-of-range version of Python (older or newer) or a 32-bit version, then you'll need to use a different version.
I installed it successfully by pip install https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.8.0-py3-none-any.whl
There are a few important rules to install Tensorflow:
You have to install Python x64. It doesn't work with x86/32b and it gives the same error as yours.
Python versions later than 3.8 and Python 3.8 requires TensorFlow 2.2 or later. Check for supported Python versions.
For example, for TensorFlow 2.9, you can install Python3.8.6-64bit and it works like a charm. Check the latest information on the website.
if you are using anaconda, python 3.7 is installed by default, so you have to downgrade it to 3.6:
conda install python=3.6
then:
pip install tensorflow
it worked for me in Ubuntu.
I am giving it for Windows
If you are using python-3
Upgrade pip to the latest version using py -m pip install --upgrade pip
Install package using py -m pip install <package-name>
If you are using python-2
Upgrade pip to the latest version using py -2 -m pip install --upgrade pip
Install package using py -2 -m pip install <package-name>
It worked for me
Tensorflow 2.2.0 supports Python3.8
First, make sure to install Python 3.8 64bit. For some reason, the official site defaults to 32bit. Verify this using python -VV (two capital V, not W). Then continue as usual:
python -m pip install --upgrade pip
python -m pip install wheel # not necessary
python -m pip install tensorflow
As usual, make sure you have CUDA 10.1 and CuDNN installed.
Tensorflow isn't available for python 3.8 (as of Dec 4th 2019) according to their documentation page. You will have to downgrade to python 3.7.
I am using python 3.6.8, on ubunu 18.04, for me the solution was to just upgrade pip
pip install --upgrade pip
pip install tensorflow==2.1.0
Uninstalling Python and then reinstalling solved my issue and I was able to successfully install TensorFlow.
Python version is not supported
Uninstall python
https://www.python.org/downloads/release/python-362/
You should check and use the exact version in install page.
https://www.tensorflow.org/install/install_windows
python 3.6.2 or python 3.5.2 solved this issue for me
(as of Jan 1st, 2021)
Any over version 3.9.x there is no support for TensorFlow 2. If you are installing packages via pip with 3.9, you simply get a "package doesn't exist" message. After reverting to the latest 3.8.x. Thought I would drop this here, I will update when 3.9.x is working with Tensorflow 2.x
So here's the message that I got on a M1 Pro while I was executing
python -m pip install tensorflow-macos
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow
I then re-installed python from the official source:
https://www.python.org/downloads/macos/
(Yes, as stupid as it seems.)
I then followed the Apple tutorial for Monterey:
https://developer.apple.com/metal/tensorflow-plugin/
Everything was solved by then.
Apple Silicon (M1+ Chip)
If you are using a Mac with an M1 chip or higher, you need to install Tensorflow metal plugin for compatability with your architecture.
Simple installation instructions for Tensor Flow are found on Apple's website: https://developer.apple.com/metal/tensorflow-plugin
Looks like the problem is with Python 3.8. Use Python 3.7 instead. Steps I took to solve this.
Created a python 3.7 environment with conda
List item Installed rasa using pip install rasa within the environment.
Worked for me.
Running this before the tensorflow installation solved it for me:
pip install "pip>=19"
As the tensorflow's system requirements states:
pip 19.0 or later
For version TensorFlow 2.2:
Make sure you have python 3.8
try:
python --version
or
python3 --version
or
py --version
Upgrade the pip of the python which has version 3.8
try:
python3 -m pip install --upgrade pip
or
python -m pip install --upgrade pip
or
py -m pip install --upgrade pip
Install TensorFlow:
try:
python3 -m pip install TensorFlow
or python -m pip install TensorFlow
or py -m pip install TensorFlow
Make sure to run the file with the correct python:
try:
python3 file.py
or python file.py
or py file.py
1.Go to https://www.tensorflow.org/install/pip website and look if the version you are using support the Tensorflow. some latest version does not support Tesnsorflow. until Tensorflow releases its latest version for that Python version.
you must have 64 bit python installed
have latest version of pip installed
pip install --upgrade pip
using pip install tensorflow --user did it for me
I had this problem on my macOS (with M1 Pro) even with the latest 64-bit Python and the latest pip installed. This is how I've solved it. Try to run:
pip install tensorflow-macos
If you will get the error ending like this (like I did)...
...
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
...then simply run:
pip install --default-timeout=100 tensorflow-macos
Tensorflow seems to need special versions of tools and libs.
Pip only takes care of python version.
To handle this in a professional way (means it save tremendos time for me and others)
you have to set a special environment for each software like this.
An advanced tool for this is conda.
I installed Tensorflow with this commands:
sudo apt install python3
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
sudo apt install python3-pip
sudo apt-get install curl
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
yes
source ~/.bashrc
installs its own phyton etc
nano .bashrc
maybe insert here your proxies etc.
conda create --name your_name python=3
conda activate your_name
conda install -c conda-forge tensorflow
check everything went well
python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"
PS: some commands that may be helpful
conda search tensorflow
https://www.tensorflow.org/install/pip
uses virtualenv. Conda is more capable. Miniconda ist sufficient; the full conda
is not necessary
use python version 3.6 or 3.7 but the important thing is you should install the python version of 64-bit.
In case you are using Docker, make sure you have
FROM python:x.y.z
instead of
FROM python:x.y.z-alpine.
This issue also happens with other libraries such as matplotlib(which doesn't support Python > 3.9 for some functions) let's just use COLAB.
Slightly different issue for me but I will still post an answer here. tensorflow package is working, but not tflite-runtime.
pip install --extra-index-url https://google-coral.github.io/py-repo/ tflite-runtime==2.5.0
I solved the same problem with python 3.7 by installing one by one all the packages required
Here are the steps:
Install the package
See the error message:
couldn't find a version that satisfies the requirement -- the name of the module required
Install the module required.
Very often, installation of the required module requires the installation of another module, and another module - a couple of the others and so on.
This way I installed more than 30 packages and it helped. Now I have tensorflow of the latest version in Python 3.7 and didn't have to downgrade the kernel.

(Debian) Dragonboard 410c: Tensorflow is not a supported wheel on this platform

I've tried several methods for installing Tensorflow (CPU-only) onto my Dragonboard 410c, and even though all other packages install just fine, Tensorflow installation always gives me the error tensorflow-1.3.0-... no matter whether I use pip or pip3.
Things I've checked for:
uname a outputs arm64 (64-bit)
pip -V && pip3 -V (both 10.0.1)
sudo apt-get update
Installing within a virtualenv
Installing using native pip
Installing using the links to the Tensorflow binaries
Even after ensuring all three of these were good, I can't install Tensorflow.

install tensorflow on cygwin error

I am new to linux and try to install tensorflow on cygwin on a windows 7 machine with only CPU following this instruction.
I tried to install with native pip however encountered some errors when running this command:
pip3 install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.1-cp36-cp36m-linux_x86_64.whl
(I omitted sudo since there's no sudo on my cygwin). The error message is:
tensorflow-1.2.1-cp36-cp36m-linux_x86_64.whl is not a supported wheel on this platform.
The python 3 on my cygwin is 3.6.1, pip3 version is 9.0.1.
Here are some basic command result:
$ python3 -V
Python 3.6.1
$ whereis python3
python3: /usr/bin/python3 /usr/bin/python3.6 /usr/lib/python3.6 /usr/include/python3.6m /usr/share/man/man1/python3.1.gz
$ pip3 -V
pip 9.0.1 from /usr/lib/python3.6/site-packages (python 3.6)
$ echo $PATH
/usr/local/bin:/usr/bin:/cygdrive/c/Program Files (x86)/ActiveState Komodo Edit 10:/cygdrive/c/ProgramData/Oracle/Java/javapath:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/Microsoft Application Virtualization Client:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/Pandoc:/cygdrive/c/Program Files/MiKTeX 2.9/miktex/bin/x64:/cygdrive/c/WINDOWS/System32/WindowsPowerShell/v1.0:/cygdrive/c/Program Files (x86)/PuTTY:/cygdrive/c/Program Files (x86)/Skype/Phone:/cygdrive/c/Program Files/1E/NomadBranch:/cygdrive/c/Users/jinhuwang/AppData/Local/rodeo/app-2.5.2/bin
I've seem many related question on stackoverflow but got no luck to find the solution to mine. Could anyone help?
From cygwin's frontpage:
Cygwin is not:
a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.

Categories

Resources