top of page

Installation of TensorFlow

Updated: Apr 4

System Requirements for TensorFlow:

Before installing TensorFlow, ensure that your system meets the following requirements -


For CPU Installation

  • Operating System: Windows 10/11, macOS, or Linux

  • Python Version: 3.7 to 3.10 (TensorFlow does not support Python 3.11+ yet)

  • Pip Version: Latest version of pip

  • RAM: At least 4GB (8GB or more recommended)

  • Disk Space: At least 5GB of free storage


For GPU Installation (for faster computations)

  • NVIDIA GPU: Compatible with CUDA-enabled GPUs

  • CUDA Toolkit: Version 11.2 or later

  • cuDNN: Version 8.1 or later

  • NVIDIA Drivers: Latest stable drivers

  • RAM: 8GB or more recommended


Command prompt showing Windows version details, and Python 3.8.0 with pip 23.3.1 versions. Text on a black background.
To check your Python and pip versions, run the following commands

Plain text on a white background displaying "nvidia-smi" in black Arial font, centered.
If you plan to use a GPU, ensure that your system supports CUDA by running

How to install TensorFlow Using pip? Follow these steps:


Step 1: Upgrade pip


Command prompt showing pip upgrade process with text in white, red, and green. Error message suggests running a command to update pip.
Before installing TensorFlow, update pip to the latest version using

Step 2: Install TensorFlow


Text-based interface showing a Terminal window with progress of downloading and installing Python packages. Green progress bars and version info visible.
Run the following command to install TensorFlow

Step 3: Verify Installation


Python terminal showing Python 3.8.0 and TensorFlow version 2.13.0 on a Windows OS.
To check if TensorFlow is installed correctly, open a Python shell and run

After running command on Python shell ,If the installation is successful, this command will print the installed TensorFlow version.


Setting up TensorFlow in Jupyter Notebook


If you plan to use TensorFlow in Jupyter Notebook, follow these steps:


Step 1: Install Jupyter Notebook


Command prompt window shows Windows version details and pip command. Text indicates notebook is already installed. Black background.
Run Above given command if you do not have Jupyter Notebook

Step 2: Install and Create a Virtual Environment


  • source tf_env/bin/activate # For macOS/Linux


Command prompt shows the process of installing virtualenv in Python on Windows. The environment "tf_env" is activated.
Run Above given Command on Window OS
  • Using a virtual environment helps manage dependencies separately.


Step 3: Install TensorFlow in the Virtual Environment


Command line window displaying the installation process of TensorFlow. Text in white, green, red, and blue details file sizes and download speeds.
After activating the virtual environment, install TensorFlow using above given command

Step 4: Install and Add a Kernel for Jupyter Notebook


Command prompt showing Python package installation with progress bars and notices for updates in a black terminal window.
Install the IPython kernel using above given command

Step 5: Launch Jupyter Notebook


Terminal showing Jupyter Notebook server startup logs, black background with green and gray text. Includes URLs and setup messages.
Start Jupyter Notebook using above command
  • After executing this command, you will go to the Jupyter Notebook Home Screen


Jupyter Notebook file explorer displaying folders like anaconda3, Documents, and more. Tabs for Files and Running are shown at the top.

  • Then, select the Python (tf_env) kernel by clicking on New tab


Jupyter Notebook interface showing files and folders, with Python 3 selected in a dropdown. Tabs include Open, Download, and Delete.

  • After Clicking on Python (tf_env) you will get this window


Jupyter Notebook interface showing an empty code cell, toolbar with icons, and text like "Untitled7" and "Trusted" against a white background.

Step 6: Verify TensorFlow Installation


JupyterLab interface with Python code to print TensorFlow version. Code: "import tensorflow as tf; print(tf.__version__)" outputs: 2.13.0.
Inside a Jupyter Notebook cell, run above given code
  • If TensorFlow is installed correctly, it will display the installed version as it shown in above picture.

 
 
 

Comments


© 2023 by newittrendzzz.com 

  • Facebook
  • Twitter
  • Instagram
bottom of page