Skip to content

dutchminator/keras-tensorflow-windows-installation

 
 

Repository files navigation

Keras-TensorFlow-GPU-Windows-Installation

10 easy steps on the installation of TensorFlow-GPU and Keras in Windows. Updated as of 2017-11-22 based on my personal experience getting things running on a GTX1080 on Windows 10.

Step 1: Install Anaconda (latest Python 3 version) Download

Step 2: Update Anaconda

Open Anaconda Prompt to type the following command(s)

conda update conda
conda update --all

Step 3: Install CUDA Toolkit 8.0 GA2 Download

Choose your version depending on your Operating System

As of writing (2017-11-22), tensorflow-gpu==1.4.0 does not support the latest CUDA 9 yet on Windows. See tensorflow/tensorflow#14244 for progress. Make sure you get CUDA 8.0 and (separately) cuBLAS patch 2 from the CUDA download archives at https://developer.nvidia.com/cuda-80-ga2-download-archive .

Be aware that the CUDA installer's default Express settings will also install (old) video drivers and other non-CUDA-relevant software. This is part of the reason why the local installer is 1.3GB (!). I prefer the network version and I uncheck all the non-CUDA options.

Step 4: Download cuDNN 6.0 for CUDA 8 Download

Choose your version depending on your Operating System. Membership registration is required.

Put your unzipped folder in C drive as follows:

C:\cudnn-8.0-windows10-x64-v6.0

Step 5: Add cuDNN into Environment PATH

Press [Win]-R, and run the command:

sysdm.cpl

From here, edit your PATH variable by following these 3 steps:

Add the following path entry in your PATH system variable. Subjected to changes in your installation path.

C:\cudnn-8.0-windows10-x64-v6.0\cuda\bin

Turn off all the prompts, as they need to be restarted to use our new environment variables.

Alternatively, follow the instructions from NVIDIA in the cuDNN Install Guide. This is especially relevant if you develop in Visual Studio and want CUDA+cuDNN support there.

Step 6: Create an Anaconda environment

Open Anaconda Prompt to type the following command(s)

conda create -n tensorflow numpy scipy matplotlib spyder

Step 7: Activate the environment

Open Anaconda Prompt to type the following command(s)

activate tensorflow

Step 8: Install TensorFlow-GPU (1.4.0)

Install the latest version (==1.4.0 as of 2017-11-22) in our tensorflow environment:

pip install tensorflow-gpu

Step 9: Install Keras

Install the latest version of keras (==2.1.1 as of 2017-11-22) in our tensorflow environment:

pip install keras

Step 10: Testing

Let's try running mnist_mlp.py in your prompt.

Open Anaconda Prompt to type the following command(s)

activate tensorflow
python mnist_mlp.py

If you get no errors: Congratulations! You have successfully run Keras (with Tensorflow backend) over GPU on Windows!

Troubleshooting

If you get errors about missing .dll files, the first step is to make sure that your PATH system variable is correctly set up to point to two CUDA folders and your cuDNN folder, as shown in the screenshot in step 5. Then, make sure you have restarted your Anaconda Prompt to properly load the new PATH variable. Note that tensorflow-gpu is quite picky about which versions of CUDA and cuDNN are supported. At the moment of writing (2017-11-22), tensorflow-gpu==1.4.0 runs on CUDA 8.0GA2 with cuDNN v6.0. The error messages you get should reflect any version mismatches (e.g. cudart64_7.dll instead of cudart64_8.dll)

About

10 easy steps to install Tensorflow-GPU and Keras in Windows. Forked to annotate with personal notes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published