M.R.VaaN
M.R.VaaN

Reputation: 27

Keras package installation

I am trying to install Keras package to use the machine learning tools. Unfortunately I am unable to do so. I have theano installed. And I have tensorflow installed in a separate environment in python 3.5 but I am trying to use python 2.7 for this. Is that the problem?

C:\Users\User>pip install tensorflow   
Collecting tensorflow   
  Could not find a version that satisfies the requirement tensorflow (from versions: )   
No matching distribution found for tensorflow   

C:\Users\User>pip install keras
Requirement already satisfied: keras in c:\users\user\anaconda2\lib\site-packages   
Requirement already satisfied: theano in c:\users\user\anaconda2\lib\site-packages (from keras)   
Requirement already satisfied: pyyaml in c:\users\user\anaconda2\lib\site-packages (from keras)   
Requirement already satisfied: six in c:\users\user\anaconda2\lib\site-packages (from keras)   
Requirement already satisfied: numpy>=1.9.1 in c:\users\user\anaconda2\lib\site-packages (from theano->keras)   
Requirement already satisfied: scipy>=0.14 in c:\users\user\anaconda2\lib\site-packages (from theano->keras)   

I am still having import error saying no tensorflow back-end found when i try to import keras

Upvotes: 2

Views: 1102

Answers (1)

Wilmar van Ommeren
Wilmar van Ommeren

Reputation: 7689

Tensorflow officially only supports Python 3.5.x on Windows. For python 2 you need to switch your backend to Theano. You can change the Keras backend to Theano in C:\Users\username\.keras\keras.json. Also check this documentation.

If you want to switch to another keras backend in the script you can also use the following code:

import os
os.environ['KERAS_BACKEND'] = "theano" #or "tensorflow"
import keras

Upvotes: 1

Related Questions