Machine Learning/Deep Learning Toolkit Installation on Windows 10

Source: Deep Learning on Medium

Go to the profile of Neil Zhang

Python 3.7/Keras 2.2.4/Tensorflow-GPU 1.13.1/PyTorch 0.3.1.post2/CUDA Toolkit 10.0/cuDNN 7.6.1 (June 2019)

Install Anaconda 2019.03 python 3.7 version

  • Download Anaconda3–2019.03-Windows-x86_64.exe
  • Install Anaconda3 following the GUI instructions
  • I installed under the default location using the default options. The ProgramData folder is hidden, so you’ll only see it if you show hidden files in File Explorer.

Install CUDA Toolkit 10.0

Install cuDNN 7.6.0 for CUDA 10.0


Add cuDNN 7.6.0 into Windows 10 Environment PATH

  • Type path in windows 10 search box
  • Open settings: Edit the System environment variables from control panel
  • In the Advanced tab, click Environment Variables…
  • Select Path under User variables for your-user-name and click Edit...
  • In the new window Edit environment variable , click New and paste following path into the text box
  • Click OK to close the window, and OK again to close the Environment Variables window and System Properties window
  • Open a Anaconda Prompt and type echo %PATH% , you should be able to see the newly added path in the output.

Setup Environment for Deep Learning on GPU

Create virtual environment

  • Open an Anaconda Prompt
  • Type following command to create an environment called tf

conda create -n tf python=3.7 numpy scipy matplotlib spyder pandas

Install Tensorflow

  • Open an Anaconda Prompt
  • Activate your environment first
activate tf
  • Install tensorflow-gpu 1.13.1
pip install --ignore-installed --upgrade tensorflow-gpu==1.13.1
  • You may see an error
ERROR: astroid 2.2.5 requires typed-ast>=1.3.0; implementation_name == "cpython", which is not installed.
  • Try install astroid independently first
pip install astroid
  • Try install tensorflow-gpu 1.13.1 again
pip install --ignore-installed --upgrade tensorflow-gpu==1.13.1
  • It should work now

Test tensorflow

  • Open a new Anaconda prompt window
#activate tf environment first
> activate tf
#run python
> python
# Type following commands in python command line tool
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(

If the system outputs the following, then you are ready to begin writing TensorFlow programs:

Hello, TensorFlow!

Install Keras

pip install keras

Test if Keras is using TensorFlow as backend

# activate 'tf' environment
(base) C:\Users\your-user-name>activate tf
(tf) C:\Users\your-user-name>python -c "import keras"
Using TensorFlow backend.

keras should be already using TensorFlow as backend.

Make Sure TensorFlow is running on GPU


#Activate 'tf' environment
#Run python
>>>import tensorflow as tf
# Creates a graph.
>>>a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
>>>b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
>>>c = tf.matmul(a, b)
# Creates a session with log_device_placement set to True.
>>>sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.

Output on my computer

MatMul: (MatMul): /job:localhost/replica:0/task:0/device:GPU:0
2019-06-10 21:15:07.721041: I tensorflow/core/common_runtime/] MatMul: (MatMul)/job:localhost/replica:0/task:0/device:GPU:0
a: (Const): /job:localhost/replica:0/task:0/device:GPU:0
2019-06-10 21:15:07.726428: I tensorflow/core/common_runtime/] a: (Const)/job:localhost/replica:0/task:0/device:GPU:0
b: (Const): /job:localhost/replica:0/task:0/device:GPU:0
2019-06-10 21:15:07.731839: I tensorflow/core/common_runtime/] b: (Const)/job:localhost/replica:0/task:0/device:GPU:0
[[22. 28.]
[49. 64.]]

If you see

Device mapping: no known devices

Then you are not running on GPU.

Make sure you have installed tensorflow-gpu instead of tensorflow.

Make sure you don’t have extra copy of tensorflow installed outside of environment tf (as setup above)

Run following command with and without environment to verify:

python -c "import tensorflow as tf"

Running Jupyter Notebook

jupyter notebook --notebook-dir=D:\Downloads

If you see error as below, it means the jupyter-notebook.exe script is not in system PATH

Error executing Jupyter command 'notebook': [Errno 'jupyter-notebook' not found] 2

Add the jupyter-notebook.exe script to PATH, you can find it in directory:


Open a new Anaconda prompt and re-try, jupyter notebook should start.