본문 바로가기

Deep Learning

[KERAS] how to install keras with tensorflow+anaconda+pycharm on windows10

반응형

Keras is a collection of libraries for easy use of tensorflow and Theano. In this post, I will exlain how to install keras on windows10 with 'tensorflow + anaconda + pycharm'.  You need to visit 2017/07/18 - [Deep Learning] - [tensorflow] How to install pycharm+anaconda+tensorflow(gpu) on window10 first.

 

1) After installing pycharm + anaconda + tensorflow(gpu)

As all of you know, Anaconda provides a seperate development environment for python. The environment (env.) can be a virtual env. so that you can create many different virtual envs. For example, assume you created two envs. with the names 'tensorflow1' and 'tensorflow2'. In 'tensorflow1', you installed python2.5 while you installed python3.5 in 'tensorflow2'. Everytime you want to develop some algorithms under python3.5, you can just create a project in pycharm and set 'tensorflow2' as a project interpreter. Otherwise, just set 'tensorflow1'.

2) Install Keras under base development env. of Anaconda

The basic env. name of Anaconda may be (C:\Users\user\Anaconda3) if you just push 'yes' button when you install Anaconda. So the easiest way to install Keras is 'install Keras under the basic env. The followings are the steps for the installation

Step1) get into the Anaconda base env. by running "Anaconda Prompt". Find the prompt program just by typing 'anaconda prompt' on windows serearch.

  

Now, you are under the base development env. of Anaconda. We will install Keras under this env.


Step2) Install packages required for Keras.

    (base) c:\Users\user>conda install -n base numpy matplotlib pandas pydotplus h5py scikit-learn
    (base) c:\Users\user>conda install -n base scipy mkl-service libpython m2w64-toolchain

Step3) install deep learning libraries

    (base) c:\Users\user>conda install -n base git graphviz
    (base) c:\Users\user>conda install -n base tensorflow-gpu

Step4) Download Keras and install it.

    (base) c:\Users\user>git clone https://github.com/fchollet/keras.git
    (base) c:\Users\user>cd keras
    (base) c:\Users\user\keras>python setup.py install

Step5) Run pycharm and create an empty project. Next, create an empty python file and write the following commands and run

import pandas
import sklearn
import pydotplus
import h5py

import theano
import tensorflow
import keras

print('scipy ' + scipy.__version__)
print('numpy ' + numpy.__version__)
print('matplotlib ' + matplotlib.__version__)
print('pandas ' + pandas.__version__)
print('sklearn ' + sklearn.__version__)
print('h5py ' + h5py.__version__)

print('tensorflow ' + tensorflow.__version__)
print('keras ' + keras.__version__)

If the installation was successful, you will see

C:\Users\user\Anaconda3\python.exe D:/22_GTAV_collected_data/keras_test/_KERAS_TEST.py
Using TensorFlow backend.
scipy 1.0.0
numpy 1.12.1
matplotlib 2.1.2
pandas 0.22.0
sklearn 0.19.1
h5py 2.7.1
tensorflow 1.1.0
keras 2.0.6

Process finished with exit code 0


Enjoy.