Kali Linux

How to Install TensorFlow with CUDA/GPU Acceleration on Kali Linux

TensorFlow is a Python library for artificial intelligence and machine learning. TensorFlow can be used to train and create new AI models, import existing AI models, load the test data and check the performance of AI models, save the trained AI models, and so on.

TensorFlow can use CPU and GPU to compute complex Artificial Intelligence (AI) and Machine Learning (ML) calculations. TensorFlow can use any CUDA-supported NVIDIA GPU to accelerate the AI/ML programs. If you don’t have a CUDA-supported GPU, TensorFlow uses the CPU for AI/ML codes. Without GPU acceleration, the performance of TensorFlow will degrade in complex AI/ML programs.

In this article, we will show you how to install TensorFlow on Kali Linux. We will also show you how to enable the TensorFlow CUDA/GPU acceleration on Kali Linux.

Topic of Contents:

  1. Installing the NVIDIA GPU Drivers on Kali Linux
  2. Installing NVIDIA CUDA and cuDNN on Kali Linux
  3. Installing Python PIP on Kali Linux
  4. Installing TensorFlow on Kali Linux
  5. Checking If TensorFlow Is Installed Correctly on Kali Linux
  6. Checking If the TensorFlow CUDA/GPU Acceleration Is Working on Kali Linux
  7. Conclusion

Installing the NVIDIA GPU Drivers on Kali Linux

For the TensorFlow CUDA/GPU acceleration to work, you must install the NVIDIA GPU drivers on Kali Linux. If you need any assistance in installing the NVIDIA GPU drivers on Kali Linux, read this article.

Installing NVIDIA CUDA and cuDNN on Kali Linux

For the TensorFlow CUDA/GPU acceleration to work on Kali Linux, you must install NVIDIA CUDA and cuDNN on Kali Linux. If you need any assistance in installing NVIDIA CUDA and cuDNN, read this article.

Installing Python PIP on Kali Linux

You need Python PIP to install TensorFlow on Kali Linux. If you need any assistance in installing Python PIP on Kali Linux, read this article.

Installing TensorFlow on Kali Linux

To install TensorFlow on Kali Linux, run the following command:

$ pip install tensorflow

TensorFlow is being installed on Kali Linux. It takes a while to complete.

A screenshot of a computer Description automatically generated

At this point, TensorFlow should be installed.

A screenshot of a computer Description automatically generated

Checking If TensorFlow Is Installed Correctly on Kali Linux

To check whether TensorFlow is installed correctly on Kali Linux and whether you can access it, run the following command:

$ python3 -c 'import tensorflow as tf; print(tf.__version__)' 2>/dev/null

If TensorFlow is working correctly and you can access it, the version number of the installed TensorFlow on Kali Linux should be displayed. In our case, TensorFlow 2.12.0 is installed on our Kali Linux machine.

A screen shot of a computer Description automatically generated with medium confidence

Checking If the TensorFlow CUDA/GPU Acceleration Is Working on Kali Linux

To check if the TensorFlow CUDA/GPU acceleration is working on Kali Linux, read the article on How to Check if TensorFlow is Using GPU.

Conclusion

We showed you how to install TensorFlow on Kali Linux. We also showed you how to enable the TensorFlow CUDA/GPU acceleration on Kali Linux.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.