Search code examples
pythonwindowsdll32bit-64bittheano

Trouble installing Theano (64 bit DLL error)


I'm working on a Windows 7 64 bit Laptop with an NVidia graphic card. I wanted to use Lasagne which uses Theano. I never would have thought this would be that complicated :/

After failing miserable on my own, I tried to follow this tutorial: http://deeplearning.net/software/theano/install_windows.html - it uses python2.7 but I wanted to use the newer 3.5 version (and I don't think that is the problem). I did everything and at the end I was able to call:

>where gcc
C:\TDM-GCC-64\bin\gcc.exe

>where gendef
C:\TDM-GCC-64\x86_64-w64-mingw32\bin\gendef.exe

>where cl
C:\Users\user\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\bin\amd64\cl.exe

>where nvcc
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v5.5\bin\nvcc.exe

>where python
C:\WinPython-64bit-3.5.1.1\python-3.5.1.amd64\python.exe
C:\Users\user\AppData\Local\Programs\Python\Python35-32\python.exe

I think this looks promising, I even checked and the python.exe is a 64 bit version (I did the size() check from some other thread). So next I downloaded Theano and I was supposed to call "python setup.py develop" but it said "unknown option develop" so I used "build" and "install" instead. I then tried to run an example but when I type "import theano" I get the following error:

>>> import theano
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
    [...]
    from theano.gof.cmodule import GCC_compiler
  File "C:\Users\user\Downloads\Theano-master\Theano-master\theano\gof\cmodule.py", line 34, in <module>
    from theano.gof import compilelock
  File "C:\Users\user\Downloads\Theano-master\Theano-master\theano\gof\compilelock.py", line 6, in <module>
    import socket  # only used for gethostname()
  File "C:\Users\user\AppData\Local\Programs\Python\Python35-32\Lib\socket.py", line 49, in <module>
    import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.

So this seems like a 64bit - 32bit DLL problem. Do you guys have any advice? Thank you very much!


Solution

  • so yes kichik you were right. I somehow put the 35-32 folder in my path when installing python. Then I always assumed it was 64 bit because I used the WinPython 64 bit version. If you look at the output of "where python" you can see that both files were in my path. This caused the problem. Changing the path fixed my problem.

    Thank you very much!