0% found this document useful (0 votes)
112 views

Install TensorFlow With Pip - TensorFlow

Install TensorFlow

Uploaded by

MuhammadAqza
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
112 views

Install TensorFlow With Pip - TensorFlow

Install TensorFlow

Uploaded by

MuhammadAqza
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2/20/2020 Install TensorFlow with pip | TensorFlow

Install TensorFlow with pip

TensorFlow 2 packages are available

tensorflow —Latest stable release with CPU and GPU support (https://www.tensor ow.org/install/gpu) (Ubuntu and Windows)

tf-nightly —Preview build (unstable). Ubuntu and Windows include GPU support (https://www.tensor ow.org/install/gpu).

Older versions of TensorFlow

For TensorFlow 1.x, CPU and GPU packages are separate:

tensorflow==1.15 —Release for CPU-only

tensorflow-gpu==1.15 —Release with GPU support (https://www.tensor ow.org/install/gpu) (Ubuntu and Windows)

System requirements

Python 3.5–3.7

pip 19.0 or later (requires manylinux2010 support)

Ubuntu 16.04 or later (64-bit)

macOS 10.12.6 (Sierra) or later (64-bit) (no GPU support)

Windows 7 or later (64-bit) (Python 3 only)

Raspbian 9.0 or later

GPU support (https://www.tensor ow.org/install/gpu) requires a CUDA®-enabled card (Ubuntu and Windows)

Installing TensorFlow 2 requires a newer version of pip.

Hardware requirements

Starting with TensorFlow 1.6, binaries use AVX instructions  (https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#CPUs_with_AVX)


which may not run on older CPUs.

Read the GPU support guide (https://www.tensor ow.org/install/gpu) to set up a CUDA®-enabled GPU card on Ubuntu or Windows.

1. Install the Python development environment on your system

ed
Python 3 Python 2.7

Check if your Python environment is already con gured:

es Python 3.5–3.7 and pip >= 19.0

thon3 --version
p3 --version
rtualenv --version

If these packages are already installed, skip to the next step.


Otherwise, install Python  (https://www.python.org/), the pip package manager  (https://pip.pypa.io/en/stable/installing/), and Virtualenv
 (https://virtualenv.pypa.io/en/stable/):

Ubuntumac OS (#mac-os)Windows (#windows)Raspberry Pi (#raspberry-pi)Other (#other)

https://www.tensorflow.org/install/pip 1/3
2/20/2020 Install TensorFlow with pip | TensorFlow

$ sudo apt update


$ sudo apt install python3-dev python3-pip
$ sudo pip3 install -U virtualenv  # system-wide install

on: Upgrading the system pip can cause problems  (https://github.com/pypa/pip/issues/5599).


n a virtual environment, use python3 -m pip for the commands below. This ensures that you upgrade and use the Python pip instead of the system pip.

2. Create a vi ual environment (recommended)

Python virtual environments are used to isolate package installation from the system.

Ubuntu / mac OSWindows (#windows)Conda (#conda)

( )
Create a new virtual environment by choosing a Python interpreter and making a ./venv directory to hold it:

$ virtualenv --system-site-packages -p python3 ./venv

Activate the virtual environment using a shell-speci c command:

$ source ./venv/bin/activate  # sh, bash, ksh, or zsh

When virtualenv is active, your shell prompt is pre xed with (venv).

Install packages within a virtual environment without affecting the host system setup. Start by upgrading pip:

(venv) $ pip install --upgrade pip

(venv) $ pip list  # show packages installed within the virtual environment

And to exit virtualenv later:

(venv) $ deactivate  # don't exit until you're done using TensorFlow

3. Install the TensorFlow pip package

Choose one of the following TensorFlow packages to install from PyPI  (https://pypi.org/project/tensor ow/):

tensorflow —Latest stable release with CPU and GPU support (https://www.tensor ow.org/install/gpu) (Ubuntu and Windows).

tf-nightly —Preview build (unstable). Ubuntu and Windows include GPU support (https://www.tensor ow.org/install/gpu).

tensorflow==1.15 —The nal version of TensorFlow 1.x.

ge dependencies are automatically installed. These are listed in the setup.py


s://github.com/tensor ow/tensor ow/blob/master/tensor ow/tools/pip_package/setup.py) le under REQUIRED_PACKAGES.

Vi ualenv installSystem install (#system-install)

( )

(venv) $ pip install --upgrade tensorflow

https://www.tensorflow.org/install/pip 2/3
2/20/2020 Install TensorFlow with pip | TensorFlow

Verify the install:

(venv) $ python -c "import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))"

ss: TensorFlow is now installed. Read the tutorials (https://www.tensor ow.org/tutorials) to get started.

Package location

A few installation mechanisms require the URL of the TensorFlow Python package. The value you specify depends on your Python version.

Version URL

Linux

Python 2.7 GPU support https://storage.googleapis.com/tensor ow/linux/gpu/tensor ow_gpu-2.1.0-cp27-cp27mu-manylinux2010_x86_64.whl

Python 2.7 CPU-only https://storage.googleapis.com/tensor ow/linux/cpu/tensor ow_cpu-2.1.0-cp27-cp27mu-manylinux2010_x86_64.whl

Python 3.5 GPU support https://storage.googleapis.com/tensor ow/linux/gpu/tensor ow_gpu-2.1.0-cp35-cp35m-manylinux2010_x86_64.whl

Python 3.5 CPU-only https://storage.googleapis.com/tensor ow/linux/cpu/tensor ow_cpu-2.1.0-cp35-cp35m-manylinux2010_x86_64.whl

Python 3.6 GPU support https://storage.googleapis.com/tensor ow/linux/gpu/tensor ow_gpu-2.1.0-cp36-cp36m-manylinux2010_x86_64.whl

Python 3.6 CPU-only https://storage.googleapis.com/tensor ow/linux/cpu/tensor ow_cpu-2.1.0-cp36-cp36m-manylinux2010_x86_64.whl

Python 3.7 GPU support https://storage.googleapis.com/tensor ow/linux/gpu/tensor ow_gpu-2.1.0-cp37-cp37m-manylinux2010_x86_64.whl

Python 3.7 CPU-only https://storage.googleapis.com/tensor ow/linux/cpu/tensor ow_cpu-2.1.0-cp37-cp37m-manylinux2010_x86_64.whl

macOS (CPU-only)

Python 2.7 https://storage.googleapis.com/tensor ow/mac/cpu/tensor ow-2.1.0-cp27-cp27m-macosx_10_9_x86_64.whl

Python 3.5 https://storage.googleapis.com/tensor ow/mac/cpu/tensor ow-2.1.0-cp35-cp35m-macosx_10_6_intel.whl

Python 3.6 https://storage.googleapis.com/tensor ow/mac/cpu/tensor ow-2.1.0-cp36-cp36m-macosx_10_9_x86_64.whl

Python 3.7 https://storage.googleapis.com/tensor ow/mac/cpu/tensor ow-2.1.0-cp37-cp37m-macosx_10_9_x86_64.whl

Windows

Python 3.5 GPU support https://storage.googleapis.com/tensor ow/windows/gpu/tensor ow_gpu-2.1.0-cp35-cp35m-win_amd64.whl

Python 3.5 CPU-only https://storage.googleapis.com/tensor ow/windows/cpu/tensor ow_cpu-2.1.0-cp35-cp35m-win_amd64.whl

Python 3.6 GPU support https://storage.googleapis.com/tensor ow/windows/gpu/tensor ow_gpu-2.1.0-cp36-cp36m-win_amd64.whl

Python 3.6 CPU-only https://storage.googleapis.com/tensor ow/windows/cpu/tensor ow_cpu-2.1.0-cp36-cp36m-win_amd64.whl

Python 3.7 GPU support https://storage.googleapis.com/tensor ow/windows/gpu/tensor ow_gpu-2.1.0-cp37-cp37m-win_amd64.whl

Python 3.7 CPU-only https://storage.googleapis.com/tensor ow/windows/cpu/tensor ow_cpu-2.1.0-cp37-cp37m-win_amd64.whl

Raspberry PI (CPU-only)

Python 3, Pi0 or Pi1 https://storage.googleapis.com/tensor ow/raspberrypi/tensor ow-2.1.0-cp35-none-linux_armv6l.whl

Python 3, Pi2 or Pi3 https://storage.googleapis.com/tensor ow/raspberrypi/tensor ow-2.1.0-cp35-none-linux_armv7l.whl

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License (https://creativecommons.org/licenses/by/4.0/),
and code samples are licensed under the Apache 2.0 License (https://www.apache.org/licenses/LICENSE-2.0). For details, see the Google Developers Site Policies
 (https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its a liates.

Last updated 2020-02-10.

https://www.tensorflow.org/install/pip 3/3

You might also like