How to Install TensorFlow in Jupyter Notebook?

In this comprehensive guide, we will walk you through the process of installing TensorFlow in Jupyter Notebook. TensorFlow is a popular open-source machine learning framework developed by Google, and Jupyter Notebook is an interactive web-based environment widely used for data science and machine learning tasks. By combining these two powerful tools, you can harness the full potential of TensorFlow within the Jupyter environment.

Install TensorFlow in Jupyter Notebook
Install TensorFlow in Jupyter Notebook


Before we begin, ensure that you have the following prerequisites in place:

Python Installed: TensorFlow is a Python library, so you need to have Python installed on your system. You can download and install Python from the official Python website (

Jupyter Notebook: If you haven’t already installed Jupyter Notebook, you can do so using pip, the Python package manager. Run the following command in your terminal or command prompt:

pip install jupyter

Step 1: Create a Virtual Environment

It’s a good practice to create a virtual environment for your TensorFlow project. This allows you to isolate your project’s dependencies and avoid conflicts with other Python packages. To create a virtual environment, use the following commands:

# Create a virtual environment
python -m venv tensorflow_env

# Activate the virtual environment
source tensorflow_env/bin/activate

Step 2: Install TensorFlow

Now that you have your virtual environment set up, you can install TensorFlow. To install the CPU version of TensorFlow, use the following pip command:

pip install tensorflow

If you want to install the GPU version for better performance, you can use this command:

pip install tensorflow-gpu

Step 3: Launch Jupyter Notebook

With TensorFlow installed, it’s time to launch Jupyter Notebook. Open your terminal, navigate to the directory where you want to create your Jupyter Notebook project, and run the following command:

jupyter notebook

This will start Jupyter Notebook in your default web browser.

Read More  How To Check Tensorflow Version?

Step 4: Create a New Jupyter Notebook

In Jupyter Notebook, click the “New” button and select “Python 3” to create a new Python notebook.

Step 5: Verify TensorFlow Installation

To ensure that TensorFlow is installed correctly, let’s import it in the Jupyter Notebook and check its version:

import tensorflow as tf

print("TensorFlow version:", tf.__version__)

If you see the TensorFlow version printed without any errors, congratulations! You have successfully installed TensorFlow in Jupyter Notebook.


In this article, we have covered the essential steps to install TensorFlow in Jupyter Notebook. By creating a virtual environment, installing TensorFlow, and verifying the installation, you are now ready to start building and running machine learning models in the powerful Jupyter Notebook environment.

By following these steps, you have access to the world of deep learning and can begin your journey into the exciting field of machine learning with TensorFlow and Jupyter Notebook.

Now, go ahead and start your machine learning projects with confidence, knowing that you have TensorFlow installed and ready to use in Jupyter Notebook.

Happy coding!

[Diagram Suggestion: Mermaid Syntax]

graph TD
  B[Create Virtual Environment]
  C[Install TensorFlow]
  D[Launch Jupyter Notebook]
  E[Create New Notebook]
  F[Verify TensorFlow Installation]
  A --> B
  B --> C
  C --> D
  D --> E
  E --> F

This clear and concise guide should help you outrank other articles on the same topic, providing users with a detailed and easy-to-follow tutorial on installing TensorFlow in Jupyter Notebook.

Leave a Reply

Your email address will not be published. Required fields are marked *