In this article, we will have explained the necessary steps to install TensorFlow on Ubuntu 22.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
TensorFlow is an end-to-end open source platform for machine learning. It is developed by the Google Brain team. It contains tools, libraries, and community resources for developers to build ML-powered applications and deep neural networks.
- Operating System with Ubuntu 22.04
- Server IPv4 Address with Superuser Privileges (Root Access)
- Gnome Terminal for Linux Desktop
- PuTTy SSH client for Windows or macOS
- Powershell for Windows 10/11
- Familiar with APT Commands
Install TensorFlow on Ubuntu 22.04 LTS
Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.
sudo apt update sudo apt upgrade sudo apt install software-properties-common apt-transport-https wget
Step 2. Install Python PIP.
Installing the Python on your Ubuntu 22.04 Jammy Jellyfish system is straightforward, Now add deadsnakes PPA repository:
sudo add-apt-repository ppa:deadsnakes/ppa
After that, install the latest version of Python 3.11 using the below command:
sudo apt install python3.11 sudo apt install python3-venv python3-dev
Once the installation is completed, we can check which version of Python3.11 is exactly installed on our system:
Now, install Python with PIP.
By default, installing python-3.11 using the following APT command should work for all those using the Python PPA repository:
sudo apt install python3-pip
Now verify the PIP 3.11 version installed with the following command below:
Step 3. Create a Directory for the TensorFlow project.
Create a directory named “
tensor_enviroment” for setting up TensorFlow by utilizing the following command:
mkdir tensor_environment cd tensor_environment
Next, create a Virtual Environment “
tensorenviroment” using “
venv” command as shown below:
python3 -m venv tensorenviroment
Then, activate the created Virtual Environment:
Once is done, upgrade python-pip package manager:
pip install --upgrade pip
Step 4. Install TensorFlow on the Ubuntu.
Execute the following command to install the TensorFlow library using pip package manager:
sudo python3 -m pip install tensorflow
verify TensorFlow installation:
sudo python3 -m pip show tensorflow
Step 5. Using TensorFlow on Ubuntu.
Now Test the working of TensorFlow for the specified purpose, run the following piece of code on your Ubuntu 22.04 terminal:
python3 -c 'import tensorflow as tf; print("Our Tensorflow version is", tf.__version__)'
That’s all you need to do to install TensorFlow on Ubuntu 22.04 LTS Jammy Jellyfish. I hope you find this quick tip helpful. For further reading on the installation of TensorFlow, please refer to their official knowledge base. I hope this article was helpful to you. If you find it useful, don’t forget to share it with your friend and family. Also, if you have any questions, please feel free to ask in the comments section. We are always there to assist you.