I am trying to study Keras library and I tried to run this example from https://github.com/fchollet/keras/tree/master/examples
\'\'\'Trains a simple deep NN
Unfortunately, Keras and Theano don't work well with Python 3 on Windows. The problem you have is connected with the fact that you have to add libpython libraries to your C++ Windows Compiler and connect it with your Python installation which could be quite harsh when you have Python 3.5 installed. I would rather advice you to install it on Python 2. Here you have an exact instruction how to do it :
How do I install Keras and Theano in Anaconda Python on Windows?
Tutorial: Theano install on Windows 7, 8, 10 Hello Everyone,
This post is a step by step tutorial on installing Theano for Windows 7, 8, and 10. It uses Theano, CUDA, and Anaconda.
Anaconda is a package manager for python that simplifies setting up python environments and installing dependencies. If you really don't want to use Anaconda, check out my older post here.
Let's get to it:
Make sure your computer has a compatible CUDA graphics card: https://developer.nvidia.com/cuda-gpus
Download CUDA https://developer.nvidia.com/cuda-downloads (I downloaded Cuda 7.5)
While that's downloading, head to https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx and get Visual Studio 2013 (the community version). Download and install, this will install the needed C++ compilers Couple of notes here, my install needed 7GB and took ~20 minutes to install Install CUDA ~7 minutes Note: Nsight won't install for older versions of Visual Studio if you don't have them, no worries
I restarted this is windows after all...
Check CUDA Navigate to C:\ProgramData\NVIDIA Corporation\CUDA Samples\v7.0\1_Utilities\deviceQuery and open the vs2013.sln file Use CTRL+F5 to run the device check and keep the cmd window open Make sure you Pass the test, otherwise there is a problem
Download and setup Anaconda https://www.continuum.io/downloads. The Python 3.5 installer is fine Install it, it will take awhile ~5-10 minutes
Download Theano https://github.com/Theano/Theano, Download Zip at the bottom right Extract
Open CMD prompt Setup a new conda environment that uses python 3.5 conda create -n name_of_your_environment python=3.5
Activate your conda environment and install dependencies activate name_of_your_environment conda install numpy scipy mingw libpython
Navigate to Theano extracted folder /Theano-master
Use python setup.py install This automatically uses 2to3 conversion
We need to add some system variables
Right click Computer -> properties -> advanced system settings -> environment variables
Add a new system variable
Name = THEANO_FLAGS
Value = floatX=float32,device=gpu,nvcc.fastmath=True
Also add Visual Studio's c++ compiler to the path
Add ;pathToYourVSInstallation\VC\bin\
Open another CMD prompt (you'll need to close the old one because it doesn't have the system variables)
activate name_of_your_environment
python
import theano
You should see something like
Using gpu device 0: Quadro K1100M (CNMeM is disabled) Now you'll be able to use Theano when you activate your conda environment.
Note: For pycharm users, PyCharm does not automatically activate the conda environment for you (bug submitted here). What you can do is just create a .bat file with these contents: call activate env_name path_to_pycharm\bin\pycharm64.exe
Worked for me, windows 8.1 like a charm.
All thanks to: http://www.islandman93.com/2016/04/tutorial-theano-install-on-windows-7-8.html
The error clearly says that it cannot find g++.exe. Theano requires a C++ compiler to generate and compile C++ code in order to accelerate execution of the code, but seems you don't have such compiler.
So either install g++ (maybe from a MinGW install) and configure the paths to the g++.exe binary in theano's configuration or disable theano's C++ code generator in the configuration.