Saturday, August 8, 2015

Installing Theano on Windows 10, 64 bits, Python 3.4 64 bits

Unfortunately, there seems to be little information regarding the installation of Theano on Windows systems. You can do it by searching on Google, but everything is spread out across different blogs, forums and groups. I'm going to try to compile this information in a single place. Hopefully, I'm not forgetting anything, but if I am, please leave a comment.

You will need numpy and scipy installed. These are easy enough to install on Windows, so I won't get into those details. I also assume that you haven't installed Python through a package like Anaconda.

First of all, run pip:


You can also update it from github to have the latest additions:



Now, the first thing I had to do was fix the problem described here. The fix involves copying the file python34.dll from C:\Windows\system32 to a temp folder and then running the following commands in a cmd window open in that temp folder (shift+right click in Explorer to open a cmd window in the folder you're in):


Then, copy the generated libpython34.a file to your system32 folder.

Next, you need to install a 64 bit MinGW. Add this to your System Path variable. It should look similar to this:


Next, you should create a file named .theanorc in C:\Users\<your username>. This is created by writing .theanorc. (notice the dot at the end) in the rename textbox in Explorer. If you don't add the dot at the end, you'll get an error. You'll want the following in this file:



Notice that you need Visual Studio 2013 for this. I tried using 2015, but that didn't work. It might work in future versions, but it didn't for me.

As a final step (although you really could have done this at any point), you should install cuDNN. Google for it, the link might change so I'm not going to post it.

To test that everything works, open IDLE or ipython and type import theano. You should get an output similar to this:



It might take a while for each output to show up, but as long as there are no erros, you should be fine.

2 comments:

  1. 'gendef' is not recognized as an internal or external command.Help!!

    ReplyDelete
  2. just download it online and add to mingw bin

    ReplyDelete

Keep it technical and related to the subject matter. Personal comments of any kind will be deleted.