Search anything:

No matching distribution found for TensorFlow using pip [SOLVED]

Internship at OpenGenus

Get this book -> Problems on Array: For Interviews and Competitive Programming

In this article, we have presented the reason behind the error "No matching distribution found for TensorFlow using pip" along with 3 approaches to fix it.

Command used:

pip install tensorflow --user


Collecting tensorflow
Could not find a version that satisfies the requirement tensorflow (from versions: )
No matching distribution found for tensorflow

Table of contents:

  1. Reason behind the error
  2. Fix 1: Install wheel file directly
  3. Fix 2: Update Python and Pip
  4. Fix 3: Build TensorFlow from source

Reason behind the error

The reason behind the issue will be that the Python installed on your system does not have a corresponding TensorFlow.

Through pip, TensorFlow only supports specific Python version and cases such as:

  • 64-bit system
  • Python version 3.7 to 3.10
  • Ubuntu 16.04 and later versions
  • Windows 7 and later version (with C++)

So, if your system has 32-bit version of Python or a lower version of Python or an older Ubuntu version, then you will face this error.

Different TensorFlow have different dependencies. For example, TensorFlow version 1.12.0 works with Python version 3.5.2 only while TensorFlow version 2.10.0 requires Python version 3.8+.

Fix 1: Install wheel file directly

If you have a pre-built wheel file that matches your system's Python and pip version, you can install the wheel file directly.

python3 -m pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-2.10.0-py3-none-any.whl

Fix 2: Update Python and Pip

Installing TensorFlow using pip requires you to have 64-bit version of Python version 3.5 to 3.8 and pip version 8.1 and above.

If you have a lower version, upgrading Python and pip will fix the problem.

pip install --upgrade pip

Fix 3: Build TensorFlow from source

If you build TensorFlow from source, you will not face this issue and TensorFlow will get build with any version of Python and pip.

  • Follow these steps:
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
  • Build the pip wheel file
bazel build -c opt --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mavx512
--copt=-mavx512f --copt=-mavx512vnni --copt=-mfpmath=both --copt=-msse4.1 
--copt=-msse4.2 -k //tensorflow/tools/pip_package:build_pip_package

Note the optimization flags used such has--copt=-mavx512f

  • Prepare the wheel file
build_pip_package /tmp/tensorflow_pkg
  • Install the wheel file and use TensorFlow
pip install tensorflow-2.10.0-wheel --force

With this article at OpenGenus, you must have fixed the issue of installing TensorFlow using pip.

Geoffrey Ziskovin

Geoffrey Ziskovin

Geoffrey Ziskovin is an American Software Developer and Author with an experience of over 30 years. He started his career with Haskell and has interviewed over 700 candidates for Fortune 500 companies

Read More

Vote for Author of this article:

No matching distribution found for TensorFlow using pip [SOLVED]
Share this