How to Install TensorFlow on Debian 9

Install TensorFlow on Debian 9, TensorFlow is a free and open supply platform for machine mastering constructed via Google. It is used by some of agencies together with Twitter, PayPal, Intel, Lenovo, and Airbus.

TensorFlow may be mounted machine-huge, in a Python digital surroundings or as a Docker box the use of pip. For getting to know purposes, it is great to install TensorFlow in a Python digital environment. This manner you could have a couple of extraordinary remoted Python environments on a unmarried pc and install a selected version of a module on a per challenge basis without worrying that it’ll have an effect on your other Projects.

This tutorial will manual you thru the technique of installing TensorFlow on Debian nine.

Install TensorFlow on Debian 9,Installing TensorFlow on Debian nine

The following sections offer a step by step instructions approximately a way to set up TensorFlow in a Python virtual environment on Debian nine.

Install TensorFlow on Debian 9,Installing Python 3 and venv

By default, Debian 9 ships with Python three.Five. To affirm that Python 3 is mounted to your gadget kind:

$ python3 -V

The output should look like this:

output
Python 3.5.3

The advocated manner to create a digital environment is by means of the usage of the venv module. Install the python3-venv package that provides the venv module by strolling the following command:

$ sudo apt install python3-venv

Once performed we’re can proceed with the following step and create a digital surroundings for our TensorFlow assignment.

Creating a Virtual Environment

Navigate to the directory in that you’d want to save your Python 3 digital environments. It can be your private home listing or any other directory in which your consumer has examine and write permissions.

Create a brand new directory for the TensorFlow undertaking and transfer into it:

$ mkdir my_tensorflow
$ cd my_tensorflow

From in the listing, run the following command to create the virtual environment:

$ python3 -m venv venv

The command above will create a listing named venv, which contains a replica of the Python binary, the Pip package deal manager, the usual Python library and different assisting documents. Use any name you want for the digital surroundings.

To start the use of the digital surroundings, you’ll want to set off it through running the set off script:

$ source venv/bin/activate

Once activated, the virtual environment’s bin directory can be delivered at the start of the $PATH variable. Also the shell’s set off will trade and it’s going to show the name of the digital environment you’re currently in. In this case this is venv.

To avoid problems when installing packages:, upgrade pip to the today’s version:

(venv) $ pip install --upgrade pip

Installing TensorFlow

Now that we’ve created a digital surroundings, the next step is to install the TensorFlow package.

(venv) $ pip install --upgrade tensorflow
If you’ve got a committed GPU and want to take advantage of its processing electricity, as opposed to tensorflow install the tensorflow-gpu bundle which includes GPU help. Within the virtual environment, you can use the command pip in place of pip3 and python instead of python3.

Once the installation is complete, verify it with the following command in an effort to print the TensorFlow model:

(venv) $ python -c 'import tensorflow as tf; print(tf.__version__)'

At the time of writing this text, the modern-day stable version of TensorFlow is 1.13.1

output
1.13.1

Your TensorFlow version may be one of a kind from the model shown above.

If you’re new to TensorFlow, visit the Get Started with TensorFlow web page and discover ways to build your first ML utility. You can also clone the TensorFlow Models or TensorFlow-Examples repositories from Github and discover and test the TensorFlow examples.

When you’re accomplished together with your paintings, type deactivate to deactivate the environment and go back on your regular shell.

(venv) $ deactivate

Conclusion

In this academic, we’ve shown you the way to set up TensorFlow Debian 9.