Install Tensorflow in Anaconda on Windows

18 May

Tensorflow works fantastic on Windows, with our without GPU acceleration.  Unfortunately, if you follow the instructions on the Tensorflow website you will probably be pretty confused – because they are incorrect.

The official installation instructions as of now tell you to do the following to install on Anaconda on Windows:

conda create -n tensorflow

activate tensorflow

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl

Which will then probably result in the following python error:

tensorflow-1.1.0-cp35-cp35m-win_amd64.whl is not a supported wheel on this platform.

This is because Google has only published Tensorflow packages for Windows that target Python 3.5.  Python 3.6 has been the default for Anaconda for quite some time now.

You can take a look at the published packages at https://pypi.python.org/pypi/tensorflow

You’ll notice that while a variety of Python versions are targetted for other platforms, Windows only supports 3.5.

So the fix is pretty easy – Just tell Anaconda to create you a Python 3.5 environment for Tensorflow instead of a 3.6 environment.

conda create -n tensorflow python=3.5 anaconda

then proceed with the official instructions

activate tensorflow

# For CPU
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl

# Or for GPU
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-win_amd64.whl

If you need to clean up your old Anaconda environments use

conda remove --name [environment name] --all

Note that these instructions have been fixed in the TF repo, but are not reflected on the site yet.

Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditEmail this to someoneShare on LinkedInShare on StumbleUpon

Leave a Reply

Your email address will not be published. Required fields are marked *