Keras: failed to switch the backend even after changing keras.json

Created on 18 Feb 2017  路  5Comments  路  Source: keras-team/keras

Hi, I changed thekeras.jsonto enforce it use Theano as backend, shown as following

bash-4.1$ cat ~/.keras/keras.json
{"floatx": "float32", "epsilon": 1e-07, "backend": "theano","image_dim_ordering": "th"}

However, when running the program, it still show that Tensorflow is backend. How to solve this issue? Thanks.

capture

stale

Most helpful comment

Did you install Keras using conda-forge? It seems that the issue is the file keras_activate.sh that comes with the forge package, the KERAS_BACKEND is hardcoded to TensorFlow for mac:

#!/bin/bash if [ "$(uname)" == "Darwin" ] then # for Mac OSX export KERAS_BACKEND=tensorflow elif [ "$(uname)" == "Linux" ] then # for Linux export KERAS_BACKEND=theano fi
See the original solution by user1118094 on Stack Exchange.

All 5 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, but feel free to re-open it if needed.

I'm having the same problem. I updated the names in my ~/.keras/keras.json file, but it made no difference. If I set the KERAS_BACKEND environment variable to theano, keras loads Theano, but it appears to be ignoring the keras.json file.

Did you install Keras using conda-forge? It seems that the issue is the file keras_activate.sh that comes with the forge package, the KERAS_BACKEND is hardcoded to TensorFlow for mac:

#!/bin/bash if [ "$(uname)" == "Darwin" ] then # for Mac OSX export KERAS_BACKEND=tensorflow elif [ "$(uname)" == "Linux" ] then # for Linux export KERAS_BACKEND=theano fi
See the original solution by user1118094 on Stack Exchange.

Yes. Thanks!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

Was this page helpful?
0 / 5 - 0 ratings