How to Install TensorFlow With Anaconda

Anika Tabassum Era Feb 15, 2024
  1. Create an Environment Variable Manually and Install TensorFlow
  2. Create an Environment to Install TensorFlow via Command Prompt
  3. Install TensorFlow via pip in the Base Environment
How to Install TensorFlow With Anaconda

Anaconda has a base (root) environment where all the applications are primarily operable, but some would need extra features to function correctly. In our example set, we will consider using the Jupyter Notebook to check the installations of the TensorFlow library.

The first method is creating a custom environment by navigating to the environment section and creating a section. Later, when the environment is created, we will install TensorFlow on that specific environment.

Next, we will open the cmd.exe application of the root environment and create the environment for TensorFlow there. And later, activating the TensorFlow allows importing the module.

And lastly, we will use pip install in the root application, so we will not require any different environment to run the applications. Rather, the base will collectively use the imports in its applications.

Let’s dig a little deep into the following parts.

Create an Environment Variable Manually and Install TensorFlow

This section covers creating new environment variables and manual installation of TensorFlow. So, in the beginning, we will notice in the upper-left portion of the Anaconda Navigator, an option is available named Environments.

If we click on that, we will be directed to an interface where we get the Create option in the bottom-left part. The next task is to name a new environment.

You must be sure when you create an environment. You must manually install TensorFlow or any other library from the navigator’s right-side filters.

The navigator filters the installed and not installed modules. After installations, select the new environment of the Home section’s Applications on and install the required application for that environment; in our case, it is Jupyter Notebook.

The entire process consumes less time and mitigates the necessity of dealing with command prompts. Either way, creating a different environment for problem-specific tasks is considered good practice.

Let’s check the output of the procedure.


Create Environment Variable Manually and Install TensorFlow

Create an Environment to Install TensorFlow via Command Prompt

We will use the base environments’ command prompt application and use the following command to initiate the installation of TensorFlow in a specified environment.

conda create -n tf2 tensorflow
conda activate tf2


Create Environment to Install TensorFlow Via Command Prompt

Install TensorFlow via pip in the Base Environment

We will launch the root environments’ command prompt in this segment and then type the following command. This will take a good amount of time to download and install all the packages that come with TensorFlow, making the base environment heavy.

Let’s check the command and the output preview.

pip install tensorflow


Install TensorFlow Via pip in the Base Environment

As in the examples’ base environment, TensorFlow has already been installed; thus, the prompt messages are slightly different. But if you use the above command, it will establish and download the necessary modules, and no other complications will be present.

Anika Tabassum Era avatar Anika Tabassum Era avatar

Era is an observer who loves cracking the ambiguos barriers. An AI enthusiast to help others with the drive and develop a stronger community.

LinkedIn Facebook

Related Article - TensorFlow Installation