This is an update of my previous article, which was about TensorFlow 1.0.
Here's a quick walkthrough on how to install CUDA, CUDA-powered TensorFlow, and Keras on Windows 10:
- Install the CUDA 8.0 toolkit from Nvidia -- this will also add CUDA's
bindirectory to Windows'
- Download cuDNN 6.0 from Nvidia. TensorFlow 1.3 requires cuDNN 6.0.
- Extract the cuDNN DLL from the downloaded cuDNN zip file, and put it in CUDA's
bindirectory, which by default is
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin.
- Download and install Python 3.5.x from Python.org. TensorFlow only supports 3.5.x on Windows, be sure to grab the 64bit version.
- On a elevated admin cmd, run
python -m pip install --upgrade pipto upgrade to the latest pip version. If you do not upgrade pip, it might not be able to find the TensorFlow packages.
- In the same cmd, run
pip install --upgrade tensorflow-gputo install the cuDNN-enabled version of TensorFlow.
- Download the latest scipy wheel file from Christoph Gohlke's homepage -- this is the least painful way (apart from Anaconda) to get scipy with LAPACK, etc. Be sure to grab the right version for Python 3.5.x, indicated by
cp35in the filename. As with Python, be sure to grab the 64bit version. Then install it with
pip install scipy‑0.19.1‑cp35‑cp35m‑win_amd64.whl.
- Install Keras by running
pip install --upgrade keras. If you would like to have the latest version from the Github repository, run
pip install git+https://github.com/fchollet/keras.gitinstead.
- Log out and in again, to be sure all environment variables set during installation are picked up correctly.
With that, the installation should be done.
To verify both TensorFlow and Keras were installed successfully, run
import tensorflow as tf import keras hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello))
from a Python prompt. There should not be any errors, but a merry
If TensorFlow has trouble finding CUDA or cuDNN, check that CUDA's
bin is really in Windows'
PATH (see Settings > System > Advanced System Settings > Advanced > Environment Variables), and make sure that the cuDNN DLL is also there.
import tensorflow already fails with a Python exception upon loading
_pywrap_tensorflow.pyd, you have either not copied the cuDNN 6.0 DLL to CUDA's
bin/ directory, or you are missing the Microsoft Visual C++ 2015 Redistributable Update 3 package.