61

I haven't seen anything about Windows compatibility -- is this on the way or currently available somewhere if I put forth some effort? (I have a Mac and an Ubuntu box but the Windows machine is the one with the discrete graphics card that I currently use with theano).

halfer
  • 19,824
  • 17
  • 99
  • 186
Tom Osterbind
  • 730
  • 1
  • 6
  • 8

7 Answers7

63

Updated 11/28/2016: Today we released the first release candidate of TensorFlow 0.12, which includes support for Windows. You can install the Python bindings using the following command in a Python shell:

C:\> pip install tensorflow

...or, if you want GPU support:

C:\> pip install tensorflow-gpu

You can also build TensorFlow yourself using Microsoft Visual C++ and NVCC (for the CUDA parts). The easiest way to build on Windows is currently to use the CMake build, and we will soon provide support for Bazel on Windows.


Previous answer: We haven't tried to build TensorFlow on Windows so far: the only supported platforms are Linux (Ubuntu) and Mac OS X, and we've only built binaries for those platforms.

For now, on Windows, the easiest way to get started with TensorFlow would be to use Docker: http://tensorflow.org/get_started/os_setup.md#docker-based_installation

It should become easier to add Windows support when Bazel (the build system we are using) adds support for building on Windows, which is on the roadmap for Bazel 0.3. You can see the full Bazel roadmap here.

In the meantime, you can follow issue 17 on the TensorFlow GitHub page.

mrry
  • 125,488
  • 26
  • 399
  • 400
  • 5
    Just want to add for other people since it's not addressed by any of the previous answers, you cannot have GPU support on Windows using Docker (afaik), so there is no good way of having GPU support until there is a native build of TensorFlow for Windows. – Steve Jan 25 '16 at 00:08
  • Python 3.5 and Cuda 8.0 is required. Both can be installed in an environment in Anaconda. – Andrey Rubshtein Dec 04 '16 at 17:52
12

As @mrry suggested, it is easier to set up TensorFlow with Docker. Here's how I managed to set it up as well as getting iPython Notebook up and running in my Docker environment (I find it really convenient to use iPython Notebook for all testing purposes as well as documenting my experiments).

I assume that you have installed both docker and boot2docker for Windows here.

First, run TensorFlow docker on daemon and set it up so Jupyter server (iPython Notebook) can be accessed from your main Windows system's browser:

docker run -dit -v /c/Users/User/:/media/disk -p 8888:8888 b.gcr.io/tensorflow/tensorflow:latest

Replace /c/Users/User/ with a path in your host you wish to mount i.e. where you can keep your iPython files. I don't know how to set it to other drives than C:, let me know if you do. /media/disk is the location in your TensorFlow docker where your host path's mounted against.

-p 8888:8888 basically means "map port 8888 in docker to 8888 in host directory". You can change the second part to other ports if you wish.

When you got it running, you can access it by running the following code:

docker exec -ti [docker-id] bash

Where [docker-id] can be found by running:

docker ps

To start your ipython notebook server from within TensorFlow's docker, run the following command:

ipython notebook --ip='*'

To allow ipython server to listen to all ip so your app may be accessible from host machine.

Instead of viewing your app in http://localhost:8888, you can only view it in http://[boot2docker-ip]:8888. To find boot2docker-ip run this in your terminal (not boot2docker terminal):

boot2docker ip
jaycode
  • 2,926
  • 5
  • 35
  • 71
  • Hmm, actually, it just worked for me on windows 10, no muss. just install docker, run quick start, run the tensorflow docker and do the convolution.py. No problemo! I'm using latest docker / latest virtual box though if that helps. Now trying to get GPU going here: https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tools/docker – Blaze Nov 12 '15 at 15:03
  • The above is for when you want to run ipython notebook server in your docker container accessible from your host's browser, and/or when you want to run it on productoon server as a daemon process. – jaycode Nov 13 '15 at 01:41
  • 1
    Gotcha. BTW, the command to use with docker quick start is slightly different (but all credit goes to jaycode for inspiration) docker run -dit -v //c/temp/:/media/disk -p 8888:8888 b.gcr.io/tensorflow/tensorflow:latest Not the "//" slashes instead of one. Use docker-machine ip default (use docker-machine ls to get that) to find out the ip address. now, if anyone knows how to get GPU working that'd be great. Still waiting for Nvidia to give me access – Blaze Nov 13 '15 at 16:04
4

Another way to run it on Windows is to install for example Vmware (a free version if you are not using it commercially), install Ubuntu Linux into that and then install TensorFlow using the Linux instructions. That is what I have been doing, it works well.

  • Is it possible to process something on GPU by a Virtual Machine? Let me ask another think, is Vmware better than VirtualBox? – Felipe Oriani Nov 10 '15 at 16:42
  • @FelipeOriani The last I checked (July 2015) it was not possible to do CUDA work through a VM as getting access to the real pcie devices is not trivial from the virtual machine abstraction. I have heard this is something that may be possible in the future, but I haven't seen it done viably yet. – o1lo01ol1o Nov 11 '15 at 18:33
4

TensorFlow is not supporting Windows at this point, but Windows has changed. Windows 10 Build 14432 includes bash.

You can download the build from https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewadvanced

enter image description here

After installation, just install/enable bash, and type bash in cmd. That's it.

enter image description here (The image is from https://blogs.windows.com/windowsexperience/2016/04/06/announcing-windows-10-insider-preview-build-14316/)

Then, run this (Python is already installed):

sudo apt-get install python-pip python-dev
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl 

Happy tensorflowing in Windows!

Sung Kim
  • 8,417
  • 9
  • 34
  • 42
  • Does this route benefit from GPU support on windows? I really would like to use Windows with TensorFlow, but only if the GPU is going to to usable – WearyWanderer May 18 '16 at 08:46
  • 1
    @WearyWanderer In this way, it seems GPU is not supported yet. I'm sure MS will fix it. – Sung Kim May 18 '16 at 10:59
3

Initial support for building TensorFlow on Microsoft Windows was added on 2016-10-05 in commit d0d975f8c3330b5402263b2356b038bc8af919a2:

This PR contains an initial version of support for building TensorFlow (CPU only) on Windows using CMake. It includes documentation for building with CMake on Windows, platform-specific code for implementing core functions on Windows, and CMake rules for building the C++ example trainer program and a PIP package (Python 3.5 only). The CMake rules support building TensorFlow with Visual Studio 2015.

Windows support is a work in progress, and we welcome your feedback and contributions.

For full details of the features currently supported and instructions for how to build TensorFlow on Windows, please see the file tensorflow/contrib/cmake/README.md.

Since 2016-10-20, GPU is supported.

Franck Dernoncourt
  • 77,520
  • 72
  • 342
  • 501
1

TensorFlow is now officially available on Windows!

TensorFlow now builds and runs on Microsoft Windows (tested on Windows 10, Windows 7, and Windows Server 2016). Supported languages include Python (via a pip package) and C++. CUDA 8.0 and cuDNN 5.1 are supported for GPU acceleration. Known limitations include: It is not currently possible to load a custom op library. The GCS and HDFS file systems are not currently supported. The following ops are not currently implemented: DepthwiseConv2dNative, DepthwiseConv2dNativeBackpropFilter, DepthwiseConv2dNativeBackpropInput, Dequantize, Digamma, Erf, Erfc, Igamma, Igammac, Lgamma, Polygamma, QuantizeAndDequantize, QuantizedAvgPool, QuantizedBatchNomWithGlobalNormalization, QuantizedBiasAdd, QuantizedConcat, QuantizedConv2D, QuantizedMatmul, QuantizedMaxPool, QuantizeDownAndShrinkRange, QuantizedRelu, QuantizedRelu6, QuantizedReshape, QuantizeV2, RequantizationRange, and Requantize.

Szabolcs
  • 832
  • 11
  • 15
George Liu
  • 3,601
  • 10
  • 43
  • 69
0

2.0 Compatible Answer: (Added on 28th Jan, 2020) To install Tensorflow 2.x (2.0 or 2.1) from Source using Bazel in Windows PC, you can run the below code:

bazel build //tensorflow/tools/pip_package:build_pip_package

To make the TensorFlow package builder with CPU-only support:

bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package

To make the TensorFlow package builder with GPU support:

bazel build --config=opt --config=cuda --define=no_tensorflow_py_deps=true //tensorflow/tools/pip_package:build_pip_package

For more information on Installing Tensorflow in Windows, refer this Tensorflow Installation Page.

Compatibility Information of Tensorflow Versions, Python Versions and Build Tools (Bazel, CMake), can be found in this link.