Skip to content

Instantly share code, notes, and snippets.

@nova77
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nova77/95c874267b126ed18693 to your computer and use it in GitHub Desktop.
Save nova77/95c874267b126ed18693 to your computer and use it in GitHub Desktop.
Getting theano to work on Win7 x64

Base stuff

First follow what's in here:

http://pavel.surmenok.com/2014/05/31/installing-theano-with-gpu-on-windows-64-bit/

64-bit bitching stuff

First get the MS python tools. This is particularly useful when you have issues such as Unable to find vcvarsall.bat during compilation:

http://www.microsoft.com/en-us/download/details.aspx?id=44266   

Now, regarding the stuff about python and compilation, you should find the details here:

http://ascend4.org/Setting_up_a_MinGW-w64_build_environment#Setup_Python_for_compilation_of_extensions

In particular:

svn co  svn://svn.code.sf.net/p/mingw-w64/code/trunk/mingw-w64-tools/gendef -r5774 ~/gendef
cd ~/gendef 
./configure --prefix=/mingw
make -j4 && make install
cd
gendef --help

copy the file c:\windows\system32\python27.dll into the folder c:\Python27\Libs Then, in msys:

cd /c/Python27/libs
mv python27.lib old-python27.lib
gendef python27.dll

Edit python27.def and replace Py_InitModule4 with Py_InitModule4_64 then run:

dlltool --dllname python27.dll --def python27.def --output-lib libpython27.a

also, since nvcc seems pretty dumb (I know, I know..):

cp libpython27.a python27.lib

Pre-built packages

Use them only for stuff that requires compiled code (eg. numpy). Generally it's the win_amd64 version.

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Example:

pip install numpy-1.9.2+mkl-cp27-none-win_amd64.whl

Graphviz

If you have installed graphviz and pydot, theano might complain that it cannot find the executable. Just add this to the registry:

[HKEY_LOCAL_MACHINE\SOFTWARE\ATT\Graphviz]
"InstallPath"="C:\\Program Files (x86)\\Graphviz2.38"

Pandoc

You have to get the binary from pandoc.

Upkeep

Theano

Make sure you're always install the dependencies with the prebuilt packages above. Then run pip with:

pip install theano --upgrade --no-deps

http://deeplearning.net/tutorial/deeplearning.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment