Changing Keras Version

Thu 22 March 2018 by Aditya Arora

Sometimes, we get errors which when looked up as Github issues dont give us a solid answer. It is told to change Theano versions to using CPU. A simple trick is to downgrade your keras version from 2.1.x to 2.0.y where y<=5. For this we have to check which version we currently have. Also note that the previous versions are not available in conda. This means we have to use pipfor installations. Also, we dont want to change any other dependencies as they are working well. - Check keras version

$ conda list keras

Output

# packages in environment at C:\Anaconda2:
#
keras                     2.1.5                    py27_0    conda-forge

We have Keras 2.1.5 and wwant to switch to Keras 2.0.5 without altering any dependencies. We remove keras with --force.

$ conda remove keras --force

We now install keras with no dependencies using --no-deps flag.

$ pip install keras==2.0.5 --no-deps

Output

Collecting keras==2.0.5
  Downloading Keras-2.0.5.tar.gz (216kB)
    100% |################################| 225kB 639kB/s
Building wheels for collected packages: keras
  Running setup.py bdist_wheel for keras ... done
  Stored in directory: C:\Users\dell\AppData\Local\pip\Cache\wheels\f9\8d\c5\efc2eeea676156ca5bed9
cfbdb63098c40336d7d2b269be5ea
Successfully built keras
Installing collected packages: keras
Successfully installed keras-2.0.5

Comments