Setting up Tensorflow in Windows 10

The Tensor Flow library has only recently been adapted to run on Windows, without requiring a Docker container, and the installation is still a little tricky.

First of all, install Anaconda on your Windows 10 machine. Get the Python 3.6 version.

Next, in a command window, run the following script:

conda create –name tensorflow python=3.5
activate tensorflow
conda install jupyter
conda install scipy
pip install tensorflow

To test the TensorFlow installation, run this script, inside the environment you created:


>>> import tensorflow as tf
>>> hello = tf.constant(‘Hello, TensorFlow!’)
>>> sess = tf.Session()
>>> print(
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print( + b))

To run TensorFlow in a Jupyter Notebook, open a new command window, activate the virtual environment, and then switch on the Jupyter server inside it:

activate tensorflow

jupyter notebook

which will open a browser window with the Jupyter menu. Select from the drop-down at the top right of the page:

New > Python 3

which will create a new Jupyter notebook in another browser tab, running in the tensorflow virtual environment. Now you can write the entire test script again in a cell:

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()

a = tf.constant(10)
b = tf.constant(32)
print( + b))

and select

Cell > Run All

to make sure it works.



You can install the tensorflow-gpu package instead, the advantage being much higher performance. In that case, you have to download and install the Cuda Toolkit as a prerequisite. The procedure is identical to the one described above, except that when you get to the line:

pip install tensorflow

you should do this instead:

pip install tensorflow-gpu

Note that I tried this approach, but it did not work, possibly because of my laptop’s hardware configuration. But feel free to try it yourself. If it does not work, just delete the virtual environment you created and start over.

This entry was posted in Anaconda, Jupyter, Machine learning, Tensorflow. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s