How to install Tensorflow and Keras into Jupyter Notebook on Mac or PC (easy steps) | by Newgin Sam Ebin Sam Dhas | Jul, 2024


Machine learning and deep learning have become integral to many modern applications, from predictive analytics to natural language processing. TensorFlow and Keras are two of the most popular libraries for these tasks. In this guide, we’ll walk through the steps to install TensorFlow and Keras in a Jupyter Notebook environment on both Mac and PC.

Go to Anaconda Distributer https://www.anaconda.com/download/success
select the appropriate installer and install the software.

If you already have anaconda installed, you can skip this step.

Anaconda Download Page

Before launching the Jupyter Notebook:

  • Mac: Open the Terminal
  • Windows: Open Anaconda command prompt

In this guide, we’ll proceed with the Terminal.

create a conda environment using the following command:

conda create --name 

Replace with a suitable name for your environment. For example, you can use tensorflow:

conda create environment

When prompted with Proceed ([y]/n)?`, enter y. Do the same if prompted in subsequent steps.

Activate the created environment using the command:

conda activate 

Replace with your environment name, for example: conda activate tensorflow`.

If activated properly, the environment name should show in the terminal instead of base as shown below.

Install TensorFlow using the following command:

conda install -c conda-forge tensorflow

That’s it! TensorFlow is now installed.

First, install ipykernel using the command:

conda install -c anaconda ipykernel

Next, set up the environment in Jupyter Notebook with the following command:

python -m ipykernel install --user --name=

Replace with your environment name

Below image is the example of the command. After Executing it shows that the tensorflow environment in added to the specific path.

Adding environment to jupyter kernal path

This command adds the environment to the Jupyter Notebook kernel.

Launch the jupyter notebook from the anaconda navigator.

Anaconda Navigator

Now, when you open a notebook, you should see the environment you created in the kernel options.

tensorflow in jupyter kernal option

You are now ready to start using TensorFlow and Keras in your Jupyter Notebook environment!



Source link

Be the first to comment

Leave a Reply

Your email address will not be published.


*