How to install TensorFlow and use it under Windows?
Updated 8/4/16
Windows 10 now has an Ubuntu Bash environment, AKA Bash on Ubuntu on Windows , available as a standard option (unlike Developer Preview Updates ). (StackOverflow wsl tag ) This option appeared with the Windows 10 Update (Version 1607) released on 8/2/2016. This allows apt-get to be used to install software packages such as Python and TensorFlow .
Note: Bash on Ubuntu on Windows does not have access to the GPU, so all GPU options for installing TensorFlow will not work.
The related installation instructions for Bash on Ubuntu on Windows are mostly correct, but only these steps are needed:
Background
Enable Windows Subsystem for Linux (GUI) Feature
Reboot when prompted
Launch Bash on Windows
The steps are no longer needed:
Enable Developer Mode
Enable Windows Subsystem Feature for Linux (command line)
Then install TensorFlow using apt-get
sudo apt-get install python3-pip python3-dev sudo pip3 install
and now check out TensorFlow
$ python3 ... >>> import tensorflow as tf >>> hello = tf.constant('Hello, TensorFlow!') >>> sess = tf.Session() >>> print(sess.run(hello)) Hello, TensorFlow! >>> a = tf.constant(10) >>> b = tf.constant(32) >>> print(sess.run(a + b)) 42 >>> exit()
and run a real neural network
python3 -m tensorflow.models.image.mnist.convolutional
Previous answer
After reading the preview of the Bash developer on Windows.
See Playing with TensorFlow on Windows by Scott Hanselman, which uses Bash on Windows 10
Original answer
Problem with Bazel
TensorFlow was not created with build automation tools such as make , but with the Google Bazel tool built in. Bazel only works on Unix- based systems such as Linux and OS X.
Since the current published / well-known tool for creating TensorFlow uses Bazel and Bazel does not work on Windows, you cannot install or run TensorFlow natively on Windows.
From Bazel Frequently Asked Questions
What about windows?
Due to its UNIX legacy, porting Bazel to Windows is significant Work. For example, Bazel makes extensive use of symbolic links, which change support levels in versions of Windows.
We are currently actively working to improve Windows support, but it still cannot be used.
Status
See: TensorFlow Error # 17
See: Problem with Bazel # 276
Decision
Decisions are listed in order of complexity and work required; from about an hour to may not even work.
Docker installation
Docker is a system for creating standalone versions of the Linux operating system running on your computer. When you install and run TensorFlow through Docker, it completely isolates the installation from existing packages on your computer.
Also see TensorFlow - which Docker image to use?
- OS X
~ 1 hour
If you have a current Mac running OS X, then see: Installation for Mac OS X
- Linux
Recommended Linux system is trending Ubuntu 14.04 LTS ( Download Page ).
but. Virtual Machine - Hardware Virtualization - Full Virtualization
~ 3 hours
Download and install a virtual machine, such as commercial VMware or the free Virtual Box , after which you can install Linux and then install TensorFlow.
When you move on to installing TensorFlow, you'll use Pip - The Python Package Management System. Visual Studio users should think about NuGet. Packages are known as wheels .
See: Protocol setup
If you need to build from source, see below: Install from sources
~ 4 hours
Note. If you plan to use a virtual machine and have never done it before, consider using the Docker option, since Docker is a virtual machine, OS, and TensorFlow, all packaged together.
b. Dual boot
~ 3 hours
If you want to run TensorFlow on the same computer on which Windows is installed and use the GPU version, you will most likely have to use this parameter as a virtual machine, type 2 hypervisor that will not allow you to access the GPU.
- Remote machine
~ 4 hours
If you have remote access to another computer on which you can install Linux and TensorFlow software and allow remote connections, you can use your Windows computer to present the remote computer as an application running on Windows.
- Cloud service
I have no experience with this. If you know, edit the answer.
Cloud such as AWS are used.
From TensorFlow Opportunity
Want to run a model as a service in the cloud? Containerize with Docker and TensorFlow only work.
From docker
Running Docker on AWS provides a highly reliable, low-cost way to quickly create, send, and run distributed applications on a scale. Docker deployment using AMI from the AWS market.
- Wait for Bazel to work on Windows.
Currently, it seems that Bazel is the only retention, however, this year a list of Bazel's Windows-based roadmap should appear.
There are two functions for Windows:
2016β02 Bazel can bootstrap itself on Windows without requiring admin privileges. 2016β12 Full Windows support for Android: Android feature set is identical for Windows and Linux/OS X.
- Build TensorFlow manually.
A few days or more, depending on your skill level. I have given up on this; too many subprojects to build and files to search.
Remember that Bazel is only used to create TensorFlow. If you get Bazel commands, and the correct source code and libraries, you should be able to create TensorFlow on Windows. See: How to get the commands executed by Bazel .
While I have not researched this yet, you can see the continuous integration for the necessary files and information on how to build them for testing. ( Readme ) ( site )
- Build Bazel on Windows
A few days or more, depending on your skill level. I also refused this; could not find the required source files needed for windows.
There is a public experimental version of the Bazel source code that loads on Windows . You can use this to make Bazel work on Windows, etc.
These solutions also require the use of Cygwin or MinGW , which adds another level of complexity.
- Use an alternate build system such as Make
If you get this to work, I would like to look at GitHub.
TensorFlow does not currently exist. This is a feature request.
See: TensorFlow Task 380
- Cross construction
If you get this to work, I would like to look at GitHub.
You create TensorFlow on Linux using Bazel, but modify the build process to bring out the wheel that can be installed on Windows. This will require detailed knowledge of Bazel in order to reconfigure and find the source code and libraries that work with Windows. An option that I would suggest only as a last resort. Perhaps this is not even possible.
- Launch the new Windows subsystem for Linux.
See: Windows Subsystem Overview for Linux
You will know as much as I do by reading the article that is referenced.
Can I use Bazel for Windows for production?
Since this is experimental software that I would not use on a production machine.
Remember that you only need Bazel to create TensorFlow. Therefore, use the experimental code on a non-production machine to create a wheel , then install the wheel on the production machine. See: Protocol setup
TL; DR;
I currently have several versions for training. Most use a VMWare 7.1 workstation to host Ubuntu 14.04 LTS or Ubuntu 15 or Debian. I also have one dual boot Ubuntu 14.04 LTS on my Windows machine to access the GPU, since the VMware machine does not have a corresponding GPU. I would recommend that you provide these computers with at least 8 GB of memory, either in RAM or in RAM, and in the swap space, since I ran out of memory several times.