Adventures in Machine Learning

Uninstalling TensorFlow made easy: Tips and Tricks

Uninstalling TensorFlow on Various Platforms

As the field of deep learning continues to evolve, software packages like TensorFlow are becoming more popular among researchers, developers, and data scientists. However, uninstalling the package isn’t always a straightforward process, especially for those who are new to deep learning or machine learning.

In this article, we will explore how to uninstall TensorFlow on various platforms, provide troubleshooting tips, and answer some common questions.

Using pip to uninstall package

Pip is one of the most popular package management systems for Python. It can be used to install, upgrade, and uninstall packages, including TensorFlow.

To uninstall TensorFlow using pip, you will need to run the following command in your terminal or command prompt:

pip uninstall tensorflow

This should uninstall the TensorFlow package and its dependencies. If you have multiple versions of TensorFlow installed, pip will prompt you to select which version to uninstall.

Using python -m command to run library module as a script

You can also use Python’s built-in module system to uninstall TensorFlow. This method works by running a module as a script from the command line.

To uninstall TensorFlow using this method, follow these steps:

  1. Open your terminal or command prompt and navigate to the directory where TensorFlow is installed.
  2. Enter the following command:
python -m pip uninstall tensorflow

Uninstalling old tensorflow-gpu package

If you have upgraded to a newer version of TensorFlow, you may want to remove the old version to free up disk space and avoid conflicts. Here’s how you can uninstall an older version of the tensorflow-gpu package using pip:

pip uninstall tensorflow-gpu

Uninstalling TensorFlow through conda

Conda is another package management system that can be used to install and manage software packages. If you have installed TensorFlow through conda, you can uninstall it using the following command:

conda remove TensorFlow

Uninstalling TensorFlow on Apple Silicon Macs

Apple Silicon Macs are computers powered by ARM processors, which are different from the Intel processors used in most computers. If you want to uninstall TensorFlow on an Apple Silicon Mac, you can use either pip or conda.

Here is how you can uninstall TensorFlow using pip:

pip uninstall tensorflow

And here is how you can uninstall it using conda:

conda remove TensorFlow

Uninstalling TensorFlow on Windows computers

If you are using a Windows computer, you may encounter a “FileNotFoundError” when trying to uninstall TensorFlow using pip. This error occurs because Windows has a path length limit of 260 characters, and the path to TensorFlow may exceed this limit.

To fix this issue, you can use the following command to uninstall TensorFlow:

pip uninstall tensorflow -v --disable-pip-version-check
rmdir /s/q C:UsersAppDataLocalTemppip-install-

The first command disables the pip version check, and the second command deletes the temporary folder where TensorFlow was installed.

Manually deleting tensorflow folder from site-packages folder

If you want to completely remove TensorFlow from your system, you can manually delete the “tensorflow” folder from the site-packages directory. Here is how you can do it:

  1. Open your terminal or command prompt and enter the following command:
pip show tensorflow
  1. This will display the location of the tensorflow package on your system.
  2. Navigate to that directory.
  3. Delete the “tensorflow” folder from the site-packages directory.

Uninstalling TensorFlow in virtual environment

If you have installed TensorFlow in a virtual environment, you will need to activate the environment before uninstalling the package. Here’s how you can do it:

  1. Open your terminal or command prompt and navigate to the directory containing your virtual environment.
  2. Activate the virtual environment using the following command:
source /bin/activate
  1. Now you can run the pip uninstall command to remove TensorFlow from the virtual environment:
pip uninstall tensorflow

Troubleshooting TensorFlow Uninstallation

FileNotFound Error on Windows computers

If you encounter a “FileNotFoundError” when trying to uninstall TensorFlow on a Windows computer, you can try the following solutions:

  1. Disable the pip version check:
pip uninstall tensorflow -v --disable-pip-version-check
  1. Delete the temporary folder where TensorFlow was installed:
rmdir /s/q C:UsersAppDataLocalTemppip-install-

Removing Windows path length limit

If you are frequently encountering path length issues on Windows, you can try to remove the path length limit by modifying the Windows registry. However, this is not recommended for novice users, as modifying the registry can cause errors and damage to your system.

Adding sudo privilege on Linux and Mac

If you encounter a permission issue when trying to uninstall TensorFlow on a Linux or Mac computer, you can add sudo privilege to the uninstall command as follows:

sudo pip uninstall tensorflow

This will prompt you to enter your password and grant permission to execute the command with administrative privileges.


Uninstalling TensorFlow can be a daunting task, especially for new users. However, with the methods and troubleshooting tips provided in this article, we hope you can uninstall TensorFlow with ease.

Remember to always backup your data before uninstalling any software, and don’t hesitate to seek help if you encounter any issues. Happy uninstalling!

Uninstalling TensorFlow from various platforms can be a challenging and time-consuming task.

This article presented various methods for uninstalling TensorFlow, such as using pip or conda, manually deleting site-packages folder, and deleting the old tensorflow-gpu package, among others. Additionally, it discussed troubleshooting tips for resolving issues encountered during the uninstallation process.

It’s essential to backup your data before uninstallation and seek assistance when necessary. Hopefully, this article has provided valuable insights into TensorFlow uninstallation and has made the process a bit less daunting for our readers.

Popular Posts