Artificial Intelligence - Keras

Back to Course

Lesson Description

Lession - #865 Keras-Installation

This part clears up about how for install Keras on your machine. Before to moving to installation, let us go through the fundamental prerequisites of Keras.


You should fulfill the accompanying requirements −
  • Any kind of OS (Windows, Linux or Mac>
  • Python version 3.5 or higher.


    Keras is python based neural network library so python should be installed on your machine. In the event that python is appropriately installed on your machine, open your terminal and type python, you could see the reaction comparable as indicated beneath,keras python keras,
    Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18>
    [MSC v.1900 64 bit (AMD64>
    ] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>
    At this point the most recent adaptation is '3.7.2'. On the off chance that Python isn't installed, then visit the official python link - www.python.org and download the most recent form in light of your OS and introduce it quickly on your system.

    Keras Installation Steps

    Step 1 - Create Virtual Environment

    Virtualenv is utilized to manage Python bundles for various project. This will be useful to try not to break the packages installed in different conditions. Along these lines, utilizing a virtual environment while creating Python applications is constantly suggested.

    Linux/Mac OS
    Linux or mac OS clients, go to your project root catalog and type the underneath order to establish virtual environment,
    python3 -m venv kerasenv
    In the wake of executing the above command, "kerasenv" directory is made with bin,lib and include folders for your installation location.

    Below command for windows users:
    py -m venv keras

    Step 2 - Activate the Environment

    This step will cinfigure python and pip executables in your shell path.

    Linux/Mac OS
    Presently we have established a virtual environment named "kerasvenv". Move to the folder and type the underneath order,
    $ cd kerasvenv kerasvenv $ source bin/activate
    Windows users move inside the "kerasenv" folder and type the underneath command,

    Step 3 - Python Libraries

    Keras depends upon the accompanying python libraries.
  • Numpy
  • Pandas
  • Scikit-learn
  • Matplotlib
  • Scipy
  • Seaborn

    Hopefully, you have installed all the above libraries on your system. If these libraries are not installed, then use the below command to install one by one.

    pip install numpy
    pip install pandas
    pip install matplotlib
    pip install scipy
    It is an open source machine learning library. It is utilized for classification, regression and clustering algorithms. Prior to moving to the installation, it requires the accompanying −

  • Python version 3.5 or higher
  • NumPy version 1.11.0 or higher
  • SciPy version 0.17.0 or higher
  • joblib 0.11 or higher.

    Presently, we introduce scikit-learn of utilizing the below command −
    pip install -U scikit-learn
    Seaborn is an amazing library that permits you to visualize your data without any problem. Utilize the below command to install −
    pip install seaborn

    Keras Installation using Python

    At this point, we have finished essential prerequisites for the installtion of Kera. Presently, install the Keras involving same method as determined below −
    pip install keras

    Quit Virtual Environment

    After completing every one of your changes in your project, then, at that point, basically run the below command to quit the environment −

    Anaconda Cloud

    We accept that you have install anaconda cloud on your machine. In the event that anaconda isn't install, then, at that point, visit the official link, www.anaconda.com/distribution and pick download based on your OS.

    Create a new conda Environment

    Launch anaconda prompt, this will open base Anaconda environment. Allow us to establish a new conda environment. This interaction is like virtualenv. Type the below command in your conda terminal −
    conda create --name PythonCPU

    Activate conda environment

    Below command is used for activate conda environment -
    activate PythonCPU

    Install spyder

    Spyder is an IDE for executing python applications. Allow us to install this IDE in our conda environment utilizing the below command −
    conda install spyder

    Install python Libraries

    We have definitely known the python libraries numpy, pandas, and so on, required for keras. You can install every one of the modules by utilizing the below syntax−

    conda install -c anaconda <module-name>
    Below is the example for install the pandas
    conda install -c anaconda pandas

    Install keras

    Presently, everything looks great so you can begin keras installation utilizing the below command −
    conda install -c anaconda keras

    Launch spyder

    Below is the command for launch spyder in your conda terminal -