keras: error in importing keras with theano
I am using anaconda with python 2.70 on windows 10_64X , but when I import keras I still get this error. I am using theano and keras tell me it’s Tensorflow ?!! _`import theano
import keras Using TensorFlow backend. Traceback (most recent call last):
File “<ipython-input-2-c74e2bd4ca71>”, line 1, in <module> import keras
File “C:\Users\moh\Anaconda2\envs\keras_env\lib\site-packages\keras__init__.py”, line 2, in <module> from . import backend
File “C:\Users\moh\Anaconda2\envs\keras_env\lib\site-packages\keras\backend__init__.py”, line 64, in <module> from .tensorflow_backend import *
File “C:\Users\moh\Anaconda2\envs\keras_env\lib\site-packages\keras\backend\tensorflow_backend.py”, line 1, in <module> import tensorflow as tf
ImportError: No module named tensorflow`_
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 15 (1 by maintainers)
If you dont have a file in your home directory.
Then just make it and put this in there. If you want you use Theano. See doc page for TensorFlow https://keras.io/backend/
$ nano ~/.keras/keras.json
{ “image_dim_ordering”: “th”, “epsilon”: 1e-07, “floatx”: “float32”, “backend”: “theano” }
https://keras.io/backend/, check out the setting in
~/.keras/keras.json
.I tried chaning the keras.json file but it did not help me. What solved the issue for me was setting the KERAS_BACKEND env variable to “theano”:
export KERAS_BACKEND=theano
This env variable is overriding the keras.json settings.
I had the same issue. I am using anaconda with python 3.6 on windows 10. I rewitre the file on this C:\Users\USERNAME\.keras path by the name of keras.json : { “floatx”: “float32”, “epsilon”: 1e-07, “backend”: “theano”, “image_data_format”: “channels_last” } Then i run
conda install -c anaconda libpython=2.0
to install libpython. It works for me. Thanks