How to Install TensorFlow in Anaconda
Last Updated :
12 Mar, 2024
TensorFlow is an open-source machine learning framework built by Google. Anaconda Navigator is a graphical user interface (GUI) application using which we work with packages and environments without using command line interface (CLI) commands. In this article, we will learn how to install TensorFlow in Anaconda.
What is TensorFlow?
TensorFlow is a popular open-source machine learning framework built by Google. It was built for Google's internal use only but was later publicly released in 2015. It is used for numerical computation, large-scale machine learning, and deep learning. TensorFlow is best for machine learning because of its features like flexibility, scalability, and ease of use. We can build various models to perform image recognition, natural language processing, speech recognition, and more.
What is an Anaconda?
Anaconda Navigator is a desktop GUI application using which users can work with various packages and environments without using CLI commands. It comes with various inbuilt applications. We can launch applications, and manage condo packages, environments, and channels using it. We can also install, run, and update packages in an environment. It is usually used online to install and download packages and when the internet is not available it automatically switches to offline mode.
Steps to install TensorFlow in Anaconda
Step 1: Install Anaconda Navigator.
Step 2: After installing Anaconda in a system, we will create a new environment where we install tensorflow. We can do the same by executing the below command in a command prompt. Here we have created a new isolated environment with name "myEnv". Whatever work we do in this environment it cannot affect the other. It is to be prefer to create a new environment before starting a new project.
conda create -n
myEnv python=3.8
Step 3: To use newly created environment, we have to activate that environment first which can be done by executing below command in a command prompt.
conda activate myEnv
Step 4: For better performance we can setup GPU. First install NVIDIA GPU driver if not installed and then execute the below command in a command prompt or terminal to install CUDA and cuDNN. This step is optional if not want to use the GPU and run the ML models on CPU only.
Step 5: TensorFlow requires the latest version of pip so, first upgrade the pip to the latest version by executing below command.
pip install --upgrade pip
Now, install tensorflow in the newly created environment.
pip install tensorflow
Step 6: Now to verify the installation of TensorFlow we can execute the below command in the Python shell.
Verify the CPU setup: Verifying the CPU setup by executing the below command.
python -c "import tensorflow as tf; print(tf.__version__); print(tf.config.list_physical_devices('CPU'))"
Verify the GPU setup: To verify the GPU setup execute the below command.
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
Now, TensorFlow is successfully install in Anaconda.
Similar Reads
How to Install R in Anaconda R is the popular programming language and environment used for statistical computing, graphical representation, and data analysis. Anaconda is a distribution of Python and R for scientific computing and data science. It can simplify package management and deployment. Installing the R in Anaconda all
3 min read
How to Install Matplotlib on Anaconda? Matplotlib is a Python library for data visualization that allows users to create static, interactive, and animated plots. If you're using Anaconda, a leading platform for Python data science, installing Matplotlib is straightforward. This guide provides you with detailed instructions to install Mat
2 min read
How to Install Anaconda on MacOS? In this article, we will learn how to install Anaconda on MacOS. Anaconda is a distribution of the Python and R programming languages for scientific computing, that aims to simplify package management and deployment. Installation using Graphical Interface Step 1: Download the Graphical installer fro
1 min read
How to Install conda in Windows? Anaconda is open-source software that contains Jupyter, spyder, etc that is used for large data processing, data analytics, heavy scientific computing. Conda is a package and environment management system that is available across Windows, Linux, and MacOS, similar to PIP. It helps in the installatio
2 min read
How to Install earthpy in Anaconda? Earthpy is a Python package that allows plotting and working with geographical raster and vector data with open source tools easier. Geopandas, which focuses on vector data, and raster, which enables the entry and output of raster data files, are both used by Earthpy. Matplotlib is also required for
1 min read