Deep Learning – Simple installation guide for Theano on Windows


 

Many tutorial videos for convolutional neural networks on youtube (e.g. https://www.youtube.com/watch?v=S75EdAcXHKk)

require the theano python library.

I spent an entire weekend figuring out how to install theano on a windows x64 machine and wanted to share the following quick installation steps:

It`s really simple if you know how! (I found that the official documentation on deeplearning.net is a bit overwhelming pointing to so many resources and alternatives. You often end up with misconfigured PATH variables or missing files or wrong compilers etc.)

The following is how it worked for me on a Windows 10 x64 Machine with Visual Studio 2015.


1) Download Anaconda for Windows x64 for Python 2.7 (Don`t use the Python 3.5 it will not work!)

https://www.continuum.io/downloads

image

2) After anaconda installation open a command prompt and execute:

conda install mingw libpython

Confirm when it asks for updates!

3) Clone the theano project to your local machine from github. (I assume you know how github works if not check https://www.youtube.com/watch?v=0fKg7e37bQE)

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

4) Open a command prompt and navigate to the theano project folder and execute:

python setup.py install

Done! This has installed theano in your global python environment.


You can test your installation by creating a test.py file with the following code line:

import theano

In a command prompt navigate to the folder containing the test.py file and execute:

python test.py 

 


Btw. as far as I understand, further steps would be required to make theano use the GPU! The installation above would only use the CPU for calculations.


Comments (15)

  1. Jake says:

    Worked so easily for me after struggling wilth all previous attempts, thanks!

  2. Jens says:

    Thanks a lot! I tried installing g++ both via cygwin and some TDM-something thing, both wouldn’t work, throwing cryptic error messages. This finally does!

  3. Michael says:

    Thank you very much , I’ve been searching and trying for about 6 hours till I found this guide , it was extremely useful.

    1. LukasSteindl says:

      happy to help! i also published a blogpost on how to activate the GPU for theano here: https://lukassteindlblog.wordpress.com/2016/03/31/

  4. Seeven Amic says:

    Hello Lukas, Please tell me whether there is a way to install Theano to work on Python 3.5? Thanks.

    1. LukasSteindl says:

      Unfortunately there is no way to make it run on 3.5 atm.

      1. Seeven Amic says:

        Thanks anyway.

      2. Leong says:

        winPython comes with Theano already installed. Current version uses python 3.

        1. Berryme says:

          theano supports py3.4, not 3.5

  5. John says:

    Thanks so much! I went to 5 or 6 places before I found this.

  6. Tushar says:

    Thanks so much for clear & simple guidelines to install Theano. I’ve gone through 4-5 sites & spending countless hours to figure this out but none of them worked.
    With your help I was able to do it so quickly, wish I had came across this earlier
    Just one query – how do I make it to work with Python 3.x?

  7. gary says:

    i want to kown how to uninstall it

    1. LukasSteindl says:

      just uninstall your anaconda pyhton environment under control panel/ add remove programs would be an option

  8. Smache says:

    Thank you very much for your post, I try to do the same steps: But i find this problem while testing thr file test.py; I would e very grateful if you could help me please:

    Problem occurred during compilation with the command line below:
    “g++” -shared -g -DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION -m64 -DMS_WIN64 -I”C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\numpy\core\include” -I”C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\include” -I”C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\theano-0.9.0dev4-py2.7.egg\theano\gof” -L”C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\libs” -L”C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64″ -o C:\Users\msmache\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-2.7.6-64\lazylinker_ext\lazylinker_ext.pyd C:\Users\msmache\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_69_Stepping_1_GenuineIntel-2.7.6-64\lazylinker_ext\mod.cpp -lpython27
    The system cannot find the path specified.

    Traceback (most recent call last):
    File “test.py”, line 1, in
    import theano
    File “C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\theano-0.9.0dev4-py2.7.egg\theano\__init__.py”, line 66, in
    from theano.compile import (
    File “C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\theano-0.9.0dev4-py2.7.egg\theano\compile\__init__.py”, line 10, in
    from theano.compile.function_module import *
    File “C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\theano-0.9.0dev4-py2.7.egg\theano\compile\function_module.py”, line 21, in
    import theano.compile.mode
    File “C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\theano-0.9.0dev4-py2.7.egg\theano\compile\mode.py”, line 10, in
    import theano.gof.vm
    File “C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\theano-0.9.0dev4-py2.7.egg\theano\gof\vm.py”, line 659, in
    from . import lazylinker_c
    File “C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\theano-0.9.0dev4-py2.7.egg\theano\gof\lazylinker_c.py”, line 127, in
    preargs=args)
    File “C:\Users\msmache\WinPython-64bit-2.7.6.4\python-2.7.6.amd64\lib\site-packages\theano-0.9.0dev4-py2.7.egg\theano\gof\cmodule.py”, line 2309, in compile_str
    (status, compile_stderr.replace(‘\n’, ‘. ‘)))
    . ception: Compilation failed (return status=1): The system cannot find the path specified.

  9. Nida says:

    Traceback (most recent call last):
    File “C:\Users\Uzel\Desktop\DEEP LEARNÝNG\calisanlenet.py”, line 13, in
    import theano
    File “C:\Users\Uzel\Anaconda2\lib\site-packages\theano\__init__.py”, line 42, in
    from theano.configdefaults import config
    File “C:\Users\Uzel\Anaconda2\lib\site-packages\theano\configdefaults.py”, line 226, in
    in_c_key=False)
    File “C:\Users\Uzel\Anaconda2\lib\site-packages\theano\configparser.py”, line 266, in AddConfigVar
    root=newroot, in_c_key=in_c_key)
    File “C:\Users\Uzel\Anaconda2\lib\site-packages\theano\configparser.py”, line 276, in AddConfigVar
    configparam.__get__(root, type(root), delete_key=True)
    File “C:\Users\Uzel\Anaconda2\lib\site-packages\theano\configparser.py”, line 324, in __get__
    self.__set__(cls, val_str)
    File “C:\Users\Uzel\Anaconda2\lib\site-packages\theano\configparser.py”, line 335, in __set__
    self.val = self.filter(val)
    File “C:\Users\Uzel\Anaconda2\lib\site-packages\theano\configparser.py”, line 383, in filter
    % (val, self.fullname), val)
    ValueError: (‘Invalid value (True;C:Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin) for configuration variable “nvcc.fastmath”.’, ‘True;C:Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin’)

    I have a this error what should I do? Please someone help me. I have visual studio 2015, Cuda 7.5, python 2.7 and theano of course.

Skip to main content