1

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!

user667804
  • 740
  • 6
  • 25

1 Answers1

0

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!

user667804
  • 740
  • 6
  • 25
  • 1
    You may have additional problems if .py scripts are associated with the py.exe launcher, since WinPython probably doesn't use the official registry keys that py.exe uses to locate installed versions. Why are you using WinPython instead of the official x64 version? – Eryk Sun Feb 03 '16 at 03:52
  • I wanted to follow that tutorial but I have the official x64 version installed (and it somehow was used, that was were the error came from). But you are right I don't like having it around. Do you have an idea how to get theano to work without it? I installed pip and manage to start a virtual environment. But pip install theano gives me: [...]mmy.cp35-win_amd64.lib" failed with exit status 1104 LINK : fatal error LNK1104: cannot open file 'python35.lib' Maybe this is why the tutorial uses WinPython and then does something weird with dlltool? – user667804 Feb 03 '16 at 16:43
  • For 3.5 you should be using Visual Studio 2015. If it's for open source or non-commercial personal use, then use the fully-featured Community edition. The official 64-bit version of Python 3.5 also already includes libpython35.a in case you'd rather (or need to) build with gcc. – Eryk Sun Feb 03 '16 at 17:37
  • I have Visual Studio 2015. I just added C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64 to my path but pip still complains about python35.lib missing. I checked and the file is there. I even added that folder to the path (it is the libs folder in my python installation). – user667804 Feb 03 '16 at 17:58
  • Sorry for the comment chain, don't know how to do it better. I followed http://stackoverflow.com/questions/29499815/how-to-install-numpy-on-windows-using-pip-install, downloaded the wheel for numpy and installed that. It worked. But trying to install theano still fails because now I get: "numpy.distutils.system_info.NotFoundError: no lapack/blas resources found". So I would go through the 20 steps to install Lapack (http://icl.cs.utk.edu/lapack-for-windows/lapack/) but with WinPython it already worked (they say WinPython automatically links to Blas/Lapack). Any advice? – user667804 Feb 03 '16 at 18:07
  • If you want those scientific packages it's simple to use a distribution like WinPython. For standard Python you can get [Christoph Gohlke's numpy build](http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy) that's linked with Intel's MKL library. – Eryk Sun Feb 03 '16 at 18:27
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/102531/discussion-between-user667804-and-eryksun). – user667804 Feb 03 '16 at 23:43