Installing Theano with GPU on Windows 64-bit

Theano is a numerical computation library for Python. It allows to use GPU for computation, and nicely fits for machine learning calculation, which is perhaps because Theano is primarily developed by a machine learning group at the University of Montreal.

I tried to install Theano to my Windows-powered machine to try GPU computations. And it was hard, as any UNIX software on Windows. To make it work these things should be set up:


Python 2.7

Use standard x64 installation from

MinGW 64



Can be installed using PIP: pip install numpy


pip install scipy


Get 64-bit version here:

If installation fails – check event log, Windows might just need reboot.



I used ‘pip install Theano’, there are more ways to install, described here:


Then you need to configure .theanorc to use GPU: (“Using the GPU” section)

Theano configuration details:

Test Theano GPU:



Make sure that .theanorc is in the home directory of your shell. For my msys installation the home directory was msys/home/USERNAME.


If you get this error while using Theano:

nvcc : fatal error : Cannot find compiler ‘cl.exe’ in PATH

Add the line to the beginning of msys.bat:

call “c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat”


Useful links

CUDA installation:

Theano installation:

Theano installation:


  • Pingback: Theano, Autoencoders and MNIST « triangleinequality

  • anaon

    Thanks for this, I was able to get theano working under windows 8.1 64. I had to install to fix a library linker issue.

  • Charles

    Thanks for this guide. I also got Theano to work on my Win 7 x64 machine (finally) after quite a bit hassle. My suggestion (at the time being) is to get the bleeding-edge version using “pip install –upgrade –no-deps git+git://” instead of simply installing with “pip install Theano”.

    I actually could not get Theano to work with the version obtained from “pip install Theano”, and there seemed to be small a bug in that version which gives me errors when trying to compile with Visual Studio 2012. That’s why I gave the bleeding-edge version a try, and it worked.

    As mentioned by the previous user, I believe libpython is needed too.

  • Anonymous

    could you please post contents of your nvcc.profile?

  • Zhengxing Chen

    Thanks man. Wrote a similar post based on yours:

    • surmenok


  • Cedric Oeldorf

    Hi! Thank you for your post. I’m running on windows 10 and have gotten to running theano on cpu. For some reason it doesn’t want to run on GPU. My .theanorc file looks as follows:

    floatX = float32
    device = gpu

    root=C:Program FilesNVIDIA GPU Computing ToolkitCUDAv7.5
    compiler_bindir=C:Program Files (x86)Microsoft Visual Studio 12.0VCbin

    ldflags =
    #ldflags=-lopenblas # placeholder for openblas support

    Would you have any suggestions?

  • Shuokai Pan

    HI thank you for your post. I have the nvcc fatal error as you mentioned in the blog. But where I can find this ‘msys.bat’ file on windows 7?

    • surmenok

      Hi Shuokai,
      On my machine it is here: c:MinGWmsysmsys.bat