Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install Tensorflow on Python 2.7 on Windows?

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

like image 341
Jake Lam Avatar asked Jul 26 '17 02:07

Jake Lam


People also ask

Which version of Python does TensorFlow support?

TensorFlow is tested and supported on the following 64-bit systems: Python 3.7–3.10. Ubuntu 16.04 or later. Windows 7 or later (with C++ redistributable)


1 Answers

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"  } 
like image 131
XPloRR Avatar answered Oct 04 '22 15:10

XPloRR