How to install TensorFlow, Theano, Keras on Windows 10 with Anaconda

10,370 views
Skip to first unread message

Jeff Gould

unread,
Jan 10, 2017, 2:41:35 AM1/10/17
to Keras-users
As a newb who just spend a weekend figuring this out, here is a recipe for other newbs that works as of mid January 2017 (no doubt things will change over time, but it's already much easier than a few months ago now that TensorFlow is available as a simple pip install on Windows):


install cuda, cuDNN if GPU
install anaconda if not already there 

from anaconda command prompt:
update conda and update conda-build (as of Jan 2017 required to build qt correctly, may be fixed later)
create conda env python=3.5
conda install numpy, matplotlib, scipy, scikit-learn (last is optional)
pip install tensorflow gpu (using URL on TensorFlow web site, Windows pip install section)
conda install mingw libpython (theano dependencies)
conda install theano (apparently no gpu yet via pip install)
conda install keras dependencies – in particular, need to install theano even if using tensorflow backend because pip install keras will try to install theano if not already installed (and something may break during this process); also install pyyaml, HDF5 and h5py
pip install keras (will install with tensorflow as backend by default)

No module named keras theano errors on attempt to import in notebook caused by failure of jupyter to install correctly in conda env, corrected by updating conda-build then reinstalling jupyter in the env

chat...@gmail.com

unread,
Jan 25, 2017, 4:31:50 PM1/25/17
to Keras-users
Hi Jeff, this saved me a headache! Thank you for putting this together!

Cheers
Mike

kurtjm...@gmail.com

unread,
Jan 25, 2017, 9:14:34 PM1/25/17
to Keras-users, chat...@gmail.com
Here are an alternative set of installation instructions, which might be more intuitive for a Windows user:

Open an Anaconda prompt and type: conda update anaconda

Open Anaconda Navigator and click on Environments
    Change the dropdown to Upgradeable and Update everything EXCEPT anaconda, hdf5, pytables and python
    Change the dropdown to Not installed and install mingw and libpython

Go to https://www.tensorflow.org/get_started/os_setup#pip_installation_on_windows to get the location of the TensorFlow file you need (CPU or GPU)  Copy the information, paste it into the Anaconda prompt and hit enter

Open Spyder and test TensorFlow (as suggested on the website)

In Navigator>Environments>Not Installed Install theano

In Spyder create and run test file as suggested in http://www.deeplearning.net/software/theano/install_windows.html#install-windows

In Spyder's IPython console type: theano.test()

In Anaconda prompt type: pip install keras

In Sypder run Getting started in 30 seconds to Keras.


Mustg Oplay

unread,
Jan 28, 2017, 6:23:57 PM1/28/17
to Keras-users
Nice post.  There may be trouble for some if they don't have a c++ compiler installed.  I had a similar post on the git:

 

gbsa...@gmail.com

unread,
Apr 7, 2017, 8:31:06 AM4/7/17
to Keras-users
Thanks Jeff for this! Worked like a charm!

carson....@gmail.com

unread,
Jun 28, 2017, 10:41:51 PM6/28/17
to Keras-users
this was perfect
Message has been deleted

owai...@gmail.com

unread,
Jan 4, 2018, 7:55:38 AM1/4/18
to Keras-users

Sir, I created a virtual environment in anaconda 3 and installed tensorflow. Now when I open my jupyter notepad on my Windows 10 machine,and wand to run my file, it shows me an error : "No module named tensorflow". kindly suggest what to do.

Carson Dahlberg, CMT

unread,
Jan 4, 2018, 8:05:35 AM1/4/18
to Keras-users
Cool, Or, you can just go to Google's TensorFlow page and follow the instructions. 😉

Also, you can just set up and environment with all needed dependencies. Then, when you open the Jupyter Notebook, the environment will display as a kernal. Open a new notebook and select that kernel. 

I also recommend learning basic ML FIRST, BEFORE learning TF. Go through the basic tutorial for sklearn. Or, take Andrew Ng's class.

Understand PCA, KNN, SVM, Linear Regression, and Decision Trees/Random Forrests. These will solve 90-95% of real world problems. 

Also, understand the data cleaning and  transforms, and hyperparameter tunning needed for each Algo. Then, how to set up a pipeline to run through most models select the best, then fine tune that model. 

I highly recommend visualization of each step as well, to understand what is going on. 

--
You received this message because you are subscribed to a topic in the Google Groups "Keras-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/keras-users/_hXfBOjXow8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to keras-users+unsubscribe@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/ed84415b-2a23-4754-a992-0dd5d950a4f5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages