TensorFlow#
TensorFlow enables your data science, machine learning, and artificial intelligence workflows. This page shows how to install TensorFlow using the conda package manager included in Anaconda and Miniconda.
TensorFlow CPU with conda is supported on 64-bit Ubuntu Linux 16.04 or later and macOS 10.12.6 or later.
TensorFlow GPU with conda is only available though version 2.4.1 (2021). For the latest TensorFlow GPU installation, follow the installation instructions on the TensorFlow website.
Install TensorFlow#
Open a terminal application and use the default bash shell.
Choose a name for your TensorFlow environment, such as “tf”.
Use the following commands to install the current release of TensorFlow. CPU-only is recommended for beginners.
conda create -n tf tensorflow conda activate tf
Note
GPU TensorFlow is only available via conda for Windows and Linux.
conda create -n tf-gpu tensorflow-gpu conda activate tf-gpu
TensorFlow is now installed and ready to use.
For using TensorFlow with a GPU, refer to the TensorFlow documentation, specifically the section on device placement.
CUDA versions#
GPU TensorFlow uses CUDA. For a version compatibility table for GPU TensorFlow on Linux, see https://www.tensorflow.org/install/source#gpu. For Windows, see https://www.tensorflow.org/install/source_windows#gpu.
GPU TensorFlow conda packages are currently only supported for Windows or Linux.
Note
TensorFlow 2.10 was the last release that supported GPU on Windows Native.
To install GPU TensorFlow with a non-default CUDA version like 9.0, run the following commands:
conda create -n tf-gpu-cuda9 tensorflow-gpu cudatoolkit=9.0
conda activate tf-gpu-cuda9
Nightly builds#
Advanced users may wish to install the latest nightly build of TensorFlow. These nightly builds are unstable and are only available as pip packages on PyPI.
To install the nightly build of CPU-only TensorFlow:
conda create -n tf-n python
conda activate tf-n
pip install tf-nightly
Or, to install the nightly build of GPU TensorFlow on Linux or Windows:
conda create -n tf-n-gpu python
conda activate tf-n-gpu
pip install tf-nightly-gpu