Install TensorFlow With Pip
Install TensorFlow With Pip
tensorflow.org/install/pip
TensorFlow
Install
bookmark_border Stay organized with collections Save and categorize content based on
your preferences.
This guide is for the latest stable version of TensorFlow. For the preview build (nightly),
use the pip package named tf-nightly. Refer to these tables for older TensorFlow
version requirements. For the CPU-only build, use the pip package named tensorflow-
cpu.
Here are the quick versions of the install commands. Scroll down for the step-by-step
instructions.
Hardware requirements
Note: TensorFlow binaries use AVX instructions which may not run on older CPUs.
The following GPU-enabled devices are supported:
NVIDIA® GPU card with CUDA® architectures 3.5, 5.0, 6.0, 7.0, 7.5, 8.0 and
higher. See the list of CUDA®-enabled GPU cards.
For GPUs with unsupported CUDA® architectures, or to avoid JIT compilation from
PTX, or to use different versions of the NVIDIA® libraries, see the Linux build from
source guide.
Packages do not contain PTX code except for the latest supported CUDA®
architecture; therefore, TensorFlow fails to load on older GPUs when
CUDA_FORCE_PTX_JIT=1 is set. (See Application Compatibility for details.)
Note: The error message "Status: device kernel image is invalid" indicates that the
TensorFlow package does not contain PTX for your architecture. You can enable compute
1/5
capabilities by building TensorFlow from source.
System requirements
Ubuntu 16.04 or higher (64-bit)
macOS 10.12.6 (Sierra) or higher (64-bit) (no GPU support)
Windows Native - Windows 7 or higher (64-bit) (no GPU support after TF 2.10)
Windows WSL2 - Windows 10 19044 or higher (64-bit)
Note: GPU support is available for Ubuntu and Windows with CUDA®-enabled cards.
Software requirements
Python 3.9–3.11
pip version 19.0 or higher for Linux (requires manylinux2014 support) and Windows.
pip version 20.3 or higher for macOS.
Windows Native Requires Microsoft Visual C++ Redistributable for Visual Studio
2015, 2017 and 2019
The following NVIDIA® software are only required for GPU support.
Step-by-step instructions
Caution: TensorFlow 2.10 was the last TensorFlow release that supported GPU on
native-Windows. Starting with TensorFlow 2.11, you will need to install TensorFlow in
WSL2, or install tensorflow-cpu and, optionally, try the TensorFlow-DirectML-Plugin
1. System requirements
Windows 7 or higher (64-bit)
Note: Starting with TensorFlow 2.10, Windows CPU-builds for x86/x64 processors are
built, maintained, tested and released by a third party: Intel. Installing the windows-native
tensorflow or tensorflow-cpu package installs Intel's tensorflow-intel package.
These packages are provided as-is. Tensorflow will use reasonable efforts to maintain the
availability and integrity of this pip package. There may be delays if the third party fails to
release the pip package. See this blog post for more information about this collaboration.
2/5
Install the Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017, and 2019.
Starting with the TensorFlow 2.1.0 version, the msvcp140_1.dll file is required from this
package (which may not be provided from older redistributable packages). The
redistributable comes with Visual Studio 2019 but can be installed separately:
3. Install Miniconda
Miniconda is the recommended approach for installing TensorFlow with GPU support. It
creates a separate environment to avoid changing any installed software in your system.
This is also the easiest way to install the required software especially for the GPU setup.
Download the Miniconda Windows Installer. Double-click the downloaded file and follow
the instructions on the screen.
conda deactivate
conda activate tf
5. GPU setup
You can skip this section if you only run TensorFlow on CPU.
6. Install TensorFlow
TensorFlow requires a recent version of pip, so upgrade your pip installation to be sure
you're running the latest version.
3/5
Then, install TensorFlow with pip.
Note: Do not install TensorFlow with conda. It may not have the latest stable version. pip
is recommended since TensorFlow is only officially released to PyPI.
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
macOS (CPU-only)
4/5
Python 3.9 https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.15.0-
cp39-cp39-macosx_10_15_x86_64.whl
Windows
5/5