Getting Tensorflow, Theano and Keras on Windows

Tahsin Mayeesha
Learning Machine Learning
3 min readJul 25, 2016

--

Updated : Since writing this tensorflow for windows came out and my workflow completely changed, so I recommend just using keras on top of Tensorflow for deep learning. I’m also updating the relevant parts with that information in mind. Also, I’m using Python 3.5 currently because Tensorflow is not available for Windows in any other version. Either way, if you need 2.7, just get an instance from AWS, they are pretty cheap or switch your OS ^___^

Getting Theano :

From the official documentation of Theano it’s mentioned that Anaconda installs all dependencies of Theano.

Step 1 :

Anaconda

ContinuumIO is providing a free Python distribution for Windows (32-bit and 64-bit), including all dependencies of Theano. If you are not eligible for a download of EPD or Canopy (via a commercial, or free academic licence), this is the easiest way to install Theano’s dependencies. Simply download and execute the installer from Anaconda download page, and execute the following in Windows command line:

$ conda install mingw libpython

Step 2 :

  • one-liner :
pip install git+https://github.com/Theano/Theano.git
  • same thing in multi-step:

From the docs we see :

Installing Theano :

Once the dependencies are installed, you can download and install Theano. We have found that in the long run, the Git install is the most useful, because you can update it with a single git pull command. Therefore we recommend it. However, a manual install without Git is also possible.

Theano is hosted on GitHub, you need Git to download it. For Windows, download and install the MSYSGIT build. Open up the Git Shell in the directory in which you want to install Theano. For the bleeding-edge version execute

git clone https://github.com/Theano/Theano.git

For the latest stable release 0.7 (as of March 2015) run instead:

git clone https://github.com/Theano/Theano.git --branch rel-0.7

Either way, a folder Theano will be created with the library downloaded to it.

Manual Installation :

To get the latest bleeding edge version got to Theano on GitHub and download the latest zip. Then unzip it somewhere.

Alternatively, you can check the latest release release 0.7 (as of March 2015) by going tohttps://github.com/Theano/Theano/releases/tag/rel-0.7 and downloading the zip.

Step 3 :

Configuring Theano :

Once you have installed Theano, cd to the folder and run

python setup.py develop

this step will add the Theano directory to you PYTHON_PATH environment variable.

Note : There’s some test scripts in the documentation too.

Getting Tensorflow :

From “Tensorflow for windows” :

Note : You must have Python 3.5 for it. I’m using the Anaconda distribution from Continuum in a separate environment.

# cpu version pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0-cp35-cp35m-win_x86_64.whl# gpu version pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.0-cp35-cp35m-win_x86_64.whl

Getting Keras :

Keras currently is the official API for tensorflow. Keras can be configured to run with Tensorflow or Theano on the backend. Just follow the instructions from here : “Switching from Tensorflow to Theano” . Installation is basically a one-liner.

pip install keras# latest updated version : pip install git+https://github.com/fchollet/keras.git

The end. This doc will probably not be actively maintained unless needed.

--

--

Tahsin Mayeesha
Learning Machine Learning

Deep Learning Engineer. New grad, CSE.GSOC 19 participant@Tensorflow. Previous GSOC 18 @ Berkman Klein Center of Internet and Society. Kaggler,fast. ai internat