How to change Keras backend (where's the json file)?

After looking at keras sources (this place):

Start up your python-binary and do the following

import os
print(os.path.expanduser('~'))
# >>> C:\\Users\\Sascha'  # will look different for different OS
  • This should be the base-directory
  • Keras will build an folder .keras there where keras.json resides (if it was already created). If it's not there, create it there
  • Example: C:\\Users\\Sascha\\.keras\\keras.json'

In case of Ubuntu,the following worked for me:

The '.keras' folder is present in your home directory,but is hidden.So,you need to unhide the hidden files in your home directory. You can see the hidden files in Ubuntu by

  • View-> show hidden files or
  • pressing ctrl+H.

You can now see the '.keras' folder in your home directory.Inside that folder,you will see the 'keras.json' file which you can modify to switch the keras backend to theano according to the official documentation https://keras.io/backend/


"Can’t find your keras.json file? : Windows
On most systems the keras.json file (and associated sub-directories) will not be created until you open up a Python shell and directly import the keras package itself.

If you find that the ~/.keras/keras.json file does not exist on your system, simply open up a shell, (optionally) access your Python virtual environment (if you are using virtual environments), and then import Keras:

$ workon keras_tf
$ python
>>> import keras
>>> quit()

"

Referenced from : keras-with-tensorflow/theano-backend