How to Fix Could not Find a Version that Satisfies the Requirement for Tensorflow
TensorFlow is an open-source platform for Artificial Intelligence, comprising extensive libraries and community resources that let researchers push the state-of-the-art in Machine Learning (ML). This platform also allows engineers to effectively manufacture and embed ML-powered applications on microcontrollers and microprocessors. While computer enthusiasts can easily install Python and PyCharm on their systems, they often encounter an error message when trying to install TensorFlow: “Could not find a version that satisfies the requirement TensorFlow (from versions: ) No matching distribution found for TensorFlow”. Many people have tried installing Flask to resolve this issue but have been unsuccessful. Thus, I have compiled some possible solutions to this problem in this guide.
As it turns out, there are several causes for this issue. Let’s proceed step-by-step and try different fixes until we can eliminate this glitch on Windows.
Method 1: Verify the Python Version on Your System
If you are running Windows 10 with Python 3.6.X, there is a high chance that a 32-bit version of Python might be running on a 64-bit machine. Keep in mind that TensorFlow is only compatible with the 64-bit installation of Python and not the 32-bit version of Python. If you’ve downloaded Python from python.org, the default installation is 32-bit. To resolve this issue, download a 64-bit installer from here.
Now, set the PATH environment variable. This variable lists the directories that will be searched for executables when you type a command in the command prompt. By adding the path to the Python executable, you can access python.exe by typing the python keyword (without needing to specify the full path to the program). If the PATH variable is not set, the following error occurs:
C:\>python 'python' is not recognized as an internal or external command, operable program or batch file.
As you can see, the command is not found. To run python.exe, you need to specify the full path to the executable. Follow the steps below to set the PATH variable:
- Right-click on My Computer and then click on the Properties button.
- On the left side of the window, look for Advanced System Settings and click on it. The System Properties window will open.
- Now, find the PATH variable option and click on Edit. Place your cursor at the end of the Variable value line and add the path to the python.exe file, preceded with the semicolon character (;). In my case, I added the following value: C:\Python36 because I want to run Python 3.6.
- Close all the windows and search for Command Prompt. In the command window, type the following command and hit enter. You will see that the 64-bit version is now installed on your system. Now, try to install TensorFlow to check whether the error still persists:
C:\>python --version Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)]
- Run the following command to install TensorFlow on your system. Hopefully, the installation will proceed without any error message. Note: TensorFlow is not yet in the PyPI repository, so you have to specify the URL to the appropriate “wheel file” for your operating system and Python version.
pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
Method 2: Downgrade Your Python Version on Anaconda
TensorFlow only supports Python 3.6.x, and only the 64-bit version. If you are using a GUI like Anaconda and Python 3.7 is installed by default, you must downgrade it to 3.6 to install TensorFlow. Run the following commands in your Anaconda prompt:
conda install python=3.6.4
After running this command, wait for a few seconds and then create a virtual environment to install TensorFlow. Name the virtual environment, for instance, “ab,” and then install the current release of CPU-only TensorFlow:
conda create -n ab tensorflow conda activate tf
After downgrading your Python version, TensorFlow should install without displaying any error. This should also work if you have installed the Desktop version of Ubuntu.
Method 3: Update the Package Installer for Python
Pip is the package installer for Python, and you can use it to install packages from the Python Package Index and other indexes. Although updates are released regularly, these packages need to be updated manually on your system by running certain commands. If they are outdated, they might cause the TensorFlow installation error. Update the pip package by running the following commands to ensure all packages are updated:
pip install --upgrade pip pip install --upgrade https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.12.0-py3-none-any.whl
After updating the pip packages, the installation should run smoothly, allowing you to develop interesting programming projects using TensorFlow.
Workaround: There may not be a version of TensorFlow that is compatible with your version of Python, especially if you’re using a new release of Python. For example, there might be a delay between the release of a new Python version and a compatible TensorFlow version. In this case, options such as downgrading to the previous Python version, compiling TensorFlow from the source code, or waiting for a compatible TensorFlow version to be released are all possible remedies to install TensorFlow on your system without any glitches.