installing Theano with Enthought Canopy on Windows
Question: I'm trying to install Theano, here is my situation.

The system is Windows 10 (64-bit), with CUDA 7.5 installed with Visual Studio
2013. The Python distribution is Enthought Canopy (2.7.10, 32-bit) with pip,
numpy (1.9.2-3) and scipy (0.17.0-2).

The installation is as follows, 1\. install Theano (0.7) with pip; 2\. install
mingw (4.8.1-2) and libpython (1.2) using enpkg tool; 3\. copy the newly
created libpython27.a into ${PYTHONHOME}/Libs; 4\. edit and save .theanorc.txt
under c:\users\${myName} as

    
    
    [global]
    devive=gpu
    floatX=float32
    
    [blas]
    ldflags=${PYTHONHOME}\Scripts -lmk2_core -lmk2_intel_thread -lmk2_rt
    
    [nvcc]
    flags=-LC:\Users\${myName}\AppData\Local\Enthought\Canopy32\User\libs
    compiler_bindir=C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
    
    [gcc]
    cxxflags=
    

When I try to import theano, I get the following warning and error:

> mod.cu(1019): warning: statement is unreachable
>
> mod.cu(1019): warning: statement is unreachable
>
> mod.cu LINK : fatal error LNK1181: cannot open input file 'cublas.lib'
>
> ['nvcc', '-shared', '-O3',
> '-LC:\Users\${myName}\AppData\Local\Enthought\Canopy32\User\libs', '--
> compiler-bindir', 'C:\Program Files (x86)\Microsoft Visual Studio
> 12.0\VC\bin', '-Xlinker', '/DEBUG', '-D HAVE_ROUND', '-m32', '-Xcompiler',
> '-DCUDA_NDARRAY_CUH=11b90075e2397c684f9dc0f7276eab8f,-D
> NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD',
> '-IC:\Users\${myName}\AppData\Local\Enthought\Canopy32\User\lib\site-
> packages\theano\sandbox\cuda',
> '-IC:\Users\${myName}\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86\lib\site-
> packages\numpy\core\include',
> '-IC:\Users\${myName}\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86\include',
> '-o',
> 'C:\Users\${myName}\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_71_Stepping_1_GenuineIntel-2.7.10-32\cuda_ndarray\cuda_ndarray.pyd',
> 'mod.cu', '-LC:\Users\${myName}\AppData\Local\Enthought\Canopy32\User\EGG-
> INFO\mingw\usr\x86_64-w64-mingw32\lib',
> '-LC:\Users\${myName}\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86\libs',
> '-LC:\Users\${myName}\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86',
> '-lpython27', '-lcublas', '-lcudart']
>
> ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc
> return status', 2, 'for cmd', 'nvcc -shared -O3
> -LC:\Users\${myName}\AppData\Local\Enthought\Canopy32\User\libs --compiler-
> bindir C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin -Xlinker
> /DEBUG -D HAVE_ROUND -m32 -Xcompiler
> -DCUDA_NDARRAY_CUH=11b90075e2397c684f9dc0f7276eab8f,-D
> NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD
> -IC:\Users\${myName}\AppData\Local\Enthought\Canopy32\User\lib\site-
> packages\theano\sandbox\cuda
> -IC:\Users\${myName}\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86\lib\site-
> packages\numpy\core\include
> -IC:\Users\${myName}\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86\include
> -o
> C:\Users\${myName}\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-Intel64_Family_6_Model_71_Stepping_1_GenuineIntel-2.7.10-32\cuda_ndarray\cuda_ndarray.pyd
> mod.cu -LC:\Users\${myName}\AppData\Local\Enthought\Canopy32\User\EGG-
> INFO\mingw\usr\x86_64-w64-mingw32\lib
> -LC:\Users\${myName}\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86\libs
> -LC:\Users\${myName}\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86
> -lpython27 -lcublas -lcudart')
>
> WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not
> available (error: cuda unavilable)

I'm wondering if it's the 32-bit Python vs 64-bit system that causes the
problem.


Answer: As @Robert point out in the comment, the warning suggests compatibility issue.
I finally solved the problem by installing the 64-bit Enthought Canopy python
distribution, the other steps are the same as described in the question.

It's worth mentioning that mingw can be installed by Enthough Canopy package
manager as well, so you don't have to download independent mingw if you are
using the distribution.

