How to install Tensorflow on Python 2.7 on Windows?

Question:

I try to install TensorFlow via pip (pip install tensorflow) but get this error

could not find a version that satisfies the requirement tensorflow (from versions: )

Is there a solution to this problem? I still wish to install it via pip

Asked By: Jake Lam

||

Answers:

If you are using windows:

If you take a gander at TensorFlow website under windows PIP installation first line says.

“Pip installation on Windows

TensorFlow supports only 64-bit Python 3.5 on Windows. We have tested the pip packages with the following distributions of Python:”

Now either install python 3.5, or use the unofficial version of Tensorflow from ANACONDA.

other way is to Download and install docker toolbox for windows https://www.docker.com/docker-toolbox Open a cmd window, and type: docker run -it b.gcr.io/tensorflow/tensorflow This should bring up a linux shell. Type python and I think all would be well!

Answered By: BlooB

Elaborating a bit on dirty_feri’s answer as it’s not quite up to date.

Tensorflow for Windows is only supported with Python 3.5 and Python 3.6 (since 1.2). As you are downloading via pip you will be receiving the latest 1.2 version so you should be able to run on 3.6.

There should be no need to use the Anaconda version of Tensorflow, the distribution is not supported and, if you are running anaconda, the pip version does just fine.

If you still require python 2.7 support for other projects then may I suggest the use of an environment manager like anaconda or virtualenv to allow you to have multiple versions of python running nicely at once.

Once you have a supported version of python installed you should be able to run pip install tensorflow and it should install in a few minutes.

Full installation instructions are available here: https://www.tensorflow.org/install/install_windows

Answered By: JCooke

If you only need TensorFlow because of Keras and your are on Python 2.7.x, you can avoid installing Tensorflow(Google) and replace it by CNTK(Microsoft). According to Jeong-Yoon Lee CNTK is a lot (about 2 to 4 times) faster than TensorFlow for LSTM (Bidirectional LSTM on IMDb Data and Text Generation via LSTM), while speeds for other type of neural networks are close to each other.
Your Keras code does not need to be modified (I checked it with 2 examples of Keras using TensorFlow and succesfully replaced TensorFlow with CNTK, without changing anything the Keras code.

So how do you install it?

-CPU-only version of CNTK:

pip install
https://cntk.ai/PythonWheel/CPU-Only/cntk-2.4-cp27-cp27m-win_amd64.whl

-GPU version of CNTK:

pip install
https://cntk.ai/PythonWheel/GPU/cntk-2.4-cp27-cp27m-win_amd64.whl

-Test CNTK install:

python -c “import cntk; print(cntk.version)”

-Install Keras: The Python Deep Learning library

pip install keras

-Enable CNTK as Keras back end iso TensorFlow

modify the “keras.json” file under %USERPROFILE%/.keras

{
    "epsilon": 1e-07, 
    "image_data_format": "channels_last", 
    "backend": "cntk", 
    "floatx": "float32" 
}
Answered By: XPloRR

I found that Tensorflow can work on CPU under intergrated Ubuntu to Windows with any version of python.

  1. You may install Ubuntu directly from Windows Store (https://www.microsoft.com/ru-ru/p/ubuntu/9nblggh4msv6)
  2. pip:
    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    python get-pip.py
  3. sudo pip install tensorflow
Answered By: Max Tkachenko

There is a great Github repo which has *.whl file to install. support py27 and py36

  1. go to fo40225’s Github Repo tensorflow-windows-wheel
  2. find a tensorflow whl version and download
  3. pip install xxx.whl (xxx is your download whl file name)
Answered By: J.Zhao