How to install Keras and its dependencies

Keras is a deep-learning API. It is used to implement neural networks. It supports multiple backend neural network computations. It provides a user-friendly and intuitive interface for building, training, and deploying deep learning models. Keras is designed to be modular, flexible, and easy to use, making it a popular choice among researchers and practitioners in artificial intelligence and machine learning.

We can install Keras using the following steps:

  1. Ensure that the Python environment is set. We can download and install Python from the official Python website.

  2. Keras runs on top of another deep learning framework called TensorFlow. So, it is required to install TensorFlow. In a terminal, type the following command to install TensorFlow:

pip install tensorflow
Command to install TensorFlow

The command above installs the latest stable version of TensorFlow.

  1. After installing TensorFlow, install Keras using the following command:
pip install keras
Command to install Keras

The command above installs the latest stable version of Keras.

  1. After completing the installation, verify if Keras is installed correctly. Use the following command to see the version installed:
pip show keras
Command to check successfull installation

We can also verify the installed version using a second method. Open a Python interpreter or an IDE like Jupyter Notebook, and try importing Keras.

import keras
Import keras in a python environment

If no error occurs, it means Keras installation is a success. It provides a user-friendly and intuitive interface for building, training, and deploying deep learning models. Keras is designed to be modular, flexible, and easy to use, making it a popular choice among researchers and practitioners in artificial intelligence and machine learning.

Note: In TensorFlow 2.4, Keras is included as part of the TensorFlow package, so we don’t need to install it separately. We can import tensorflow.keras instead of keras if we have TensorFlow version 2.4 or above.

We can practice the commands provided above in the terminal below. The Python environment is already set for us.

Terminal 1
Terminal
Loading...

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved