Trusted answers to developer questions

How to install Keras in Anaconda

Get Started With Data Science

Learn the fundamentals of Data Science with this free course. Future-proof your career by adding Data Science skills to your toolkit — or prepare to land a job in AI, Machine Learning, or Data Analysis.

Keras is a high-level, neural network API written in Python. This deep learning Python library can run on top of other source platforms like TensorFlow.

Keras is based on minimizing the delay between the implementation of an idea and the result. The minimization of this delay is the key to good research.

Installing Keras in Anaconda

Installing a Python package is generally easy. We just pip our way through any package like this:

pip install <package>

It is not a viable option in Anaconda to pip install keras. So, we have to adapt to a better approach. Take a look at the steps below:

Step 1

Open the Anaconda Prompt and create a new environment. I have named my environment new_env—type in the command in my Anaconda Prompt terminal:

conda create --name new_env

Make sure you run Anaconda Prompt as Administrator.

Step 2

Activate the environment, type:

activate new_env

Step 3

Now, it’s the time to install Keras. Type the following command:

install -c anaconda keras

This will install keras and many other libraries, including numpy, tensorflow, etc. The command will take some time to download and install all the relevant packages.

Make sure you press y–(Yes) when asked to continue.

Step 4

Since this is a new environment, a few more installations are required; otherwise, a ModuleNotFoundError could be generated. Many users using Anaconda either work with Spyder or Jupyter Notebook. Therefore, a user is required to run the following commands, one by one:

conda install spyder
conda install jupyter

If any of the packages are still missing, install the library using the following command:

conda install <package>
// package could be matplotlib, pandas, etc.

You are done with the installation of Keras in Anaconda – happy coding!

RELATED TAGS

keras
anaconda kera
keras install anaconda

CONTRIBUTOR

Sarvech Qadir
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?