Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install TensorFlow on Ubuntu 20.04 - DesignLinux

Jul 19 2020
designlinux 0 Comments
How to Install TensorFlow on Ubuntu 20.04

TensorFlow is an open-source and free software library for machine learning developed by Google. It can be installed system-wide, in a Python virtual environment, as a Docker container, or with Anaconda. Also, large companies like Airbus, Intel, Twitter, PayPal, and Lenovo using TensorFlow. In this tutorial we will show you how to install TensorFlow in a Python virtual environment on Ubuntu 20.04.

Installing TensorFlow on Ubuntu#

By default Python 3.8 included with Ubuntu 20.04. Run below command to verify whether Python 3 is available on your system:

python3 -V

It should show below output:

Python 3.8.2

The venv environment module is included in the python3-venv package and it’s easy and recommended way to create a virtual environment.

Run the following command to install the python3-venv package:

sudo apt install python3-venv python3-dev

After completion of installation, you can create a virtual environment for our TensorFlow project.

First, you have to navigate to the directory where you would like to store your Python 3 virtual environments. Make sure the user has read and write permissions of that directory.

Create a new directory for the TensorFlow project and cd into it:

mkdir tensorflow_demo
cd tensorflow_demo

To create the virtual environment, run the following command:

python3 -m venv venv

The above command will create a directory named venv and it contains a clone of the Python binary, the standard Python library, and other supporting files, the Pip package manager.

To activate it run the activate script:

source venv/bin/activate

Once activated, the virtual environment’s bin directory will be added at the beginning of the system $PATH variable . Also, the shell’s prompt will change, and it will show the name of the virtual environment you’re currently in. In this example, that is (venv).

The pip version 19 or higher is required for TensorFlow installation. To upgrade pip to the latest version run the following command:

pip install --upgrade pip

Now at this stage, the virtual environment is activate and we can install the TensorFlow package.

pip install --upgrade tensorflow

That’s it! TensorFlow installation is complete successfully and you can start using it.

Verify the installation by typing:

python -c 'import tensorflow as tf; print(tf.version)'

It should show the latest stable version of TensorFlow, at the time of writing this article the latest version is 2.2.0:

2.2.0

Conclusion#

You have successfully learned how to install TensorFlow inside a virtual environment on Ubuntu 20.04. To know more about TensorFlow, visit the Get Started with TensorFlow page.

If you have any problem or feedback, please leave a comment below.

Related

Tags: python, ubuntu

How to Check Memory Usage in Linux

Prev Post

How to Delete Lines in Vim / Vi

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 5
  • 501
  • 612,680

DesignLinux.com © All rights reserved

Go to mobile version