Installing Tensorflow on Windows using WSL / Bash on Ubuntu on Windows

After installing Windows Subsystem for Linux, aka Bash on Ubuntu on Windows, I just had to test if Tensorflow worked. And it does, after a fashion.

Basically you need follow this Virtualenv guide official user guide. I haven’t tried GPU installation yet, but I doubt it will work.

# Get python, pip and virtualenv installed
sudo apt-get install python-pip python-dev python-virtualenv
# Setup virtualenv
virtualenv --system-site-packages ~/tensorflow
# Activate virtualenv
source ~/tensorflow/bin/activate
# Set installation
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.10.0rc0-cp27-none-linux_x86_64.whl
# Do installation
pip install --upgrade $TF_BINARY_URL
# Do your stuff!
# Deactivate virtualenv once done
deactivate

To run an example:

cd ~/tensorflow/lib/python2.7/site-packages/tensorflow/models/image/mnist/
python convolutional.py
# Wait a zillion years until your network is trained...

To run again:


# Activate virtualenv
source ~/tensorflow/bin/activate
# do you stuff!
# Deactivate virtualenv once done
deactivate

Happy days!