Skip to content
Home » Uninstall TensorFlow – Full Guide

Uninstall TensorFlow – Full Guide

uninstall tensorflow

If you have ever installed tensorflow on your computer, then you probably know how difficult it was to get it up and running. This is more apparent when you install tensorflow on a computer with a slow internet connection. Or when you gotta install tensorflow in your GPU. But today we are not going to talk about installing tensorflow. Instead, we are looking at one of the most typed queries about tensorflow in google. Which is “uninstall tensorflow“.

Why do you have to uninstall tensorflow?

As good as tensorflow can be, sometimes it can also cause a lot of problems and become one of your biggest pains. Especially, when you don’t know what you are dealing with and what exactly you want to achieve with this open-source, behemoth software library for machine learning. Moreover, if you have a corrupted installation then you probably need to uninstall tensorflow from your computer and reinstall it. There’s no way around it then starting over.

Easy basic commands to uninstall tensorflow from your computer using PIP

Probably the most basic way to get rid of tensorflow is running “pip uninstall tensorflow

If you have installed tensorflow using the default method, then you have it installed into your computer’s CPU. So in order to uninstall it from your CPU, you must run the following command in your terminal.

pip uninstall tensorflow-cpu

If you installed tensorflow into your computer’s GPU then you need to run the following command to uninstall it completely from your GPU.

pip uninstall tensorflow-gpu

Tensorflow package not found error

package not found error in uninstall tensorflow command

Maybe you have already come across this “PackagesNotFoundError” while you were trying to uninstall tensorflow. This error can be quite common…

You have installed tensorflow using conda

PackagesNotFoundError” is a common error when python cannot locate a specific package to uninstall. You may have installed tensorflow using conda which comes up with anaconda distribution. In such cases, you must use the appropriate uninstall/remove method that suits your installation.

Find out which package manager has installed which package run following commands in your terminal/cmd.

List all the packages installed with conda type and run the following command.

conda list

List all the packages installed with pip type and run the following command.

pip list

Check the resulting list of packages and determine which method you have used to install tensorflow.

If you have installed tensorflow using conda, then type and run the following command to uninstall tensorflow for your computer.

conda remove tensorflow

Do you have Anaconda installed? Then which version is it? What Conda version are you running inside Anaconda? Take a look at these posts if you want to find out >>

How to Check Anaconda Version in Windows?

How To Check Conda Version in Windows?

Path mismatch

Sometimes, the pip path you used to install tensorflow isn’t the current pip path that you are trying to run uninstall tensorflow with. If this is the case, you must find the Python environment where the TensorFlow that you are trying to uninstall exists and run. And run the following command.

 /path/to/your/python/tensorflow/ -m pip uninstall tensorflow

Activate your virtual enviornment where you have your tensorflow lives and runs

If you have installed tensorflow in a virtual environment first you need to activate that environment before running the uninstall or remove commands. Otherwise, you would get a package/s not found error or a similar error again.

How to uninstall tensorflow If you have built it from the source

If you have built the tensorflow from the source(from the setup.py), first you must locate the source directory within your terminal or CMD. And run the following command to delete tensorflow within your source directory.

python setup.py develop --uninstall

Uninstall Tensorflow manually (Delete the tensorflow folder!)

If all the above commands fail to execute or locate tensorflow to delete or remove then your last and ultimate solution is to delete the tensorflow installation folder. To do this first you need to find the location of your tensorflow installation.

to find the tensorflow locations simply run

pip show tensorflow

pip show tensorflow

Why did I get a “package not found error“? Well, it’s because I have created a python virtual environment to install tensorflow into. So, I must activate that environment and try to run the command again within it again.

I have used conda to create the virtual environment called “tensorflow“, so I typed the following commands.

conda activate tensorflow

pip show tensorflow

pip show tensoflow in virtual enviorment

Now you may go to that location and manually delete the tensorflow installation. This should delete tensorflow from your computer completely.

Conclusion

Both Installing and deleting tensorflow can be quite frustrating! Sometimes people spend hours and hours trying to accomplish these tasks. But I have covered almost all the possible scenarios, errors, and situations regarding how to uninstall tensorflow completely from your system.

If you need to find in-depth information about tensorflow, I suggest taking a visit to the official page here.

https://www.tensorflow.org/

2 thoughts on “Uninstall TensorFlow – Full Guide”

  1. Pingback: TensorFlow version in CMD and Anaconda Prompt - NeuralNet Lab

  2. Pingback: Conda Uninstall Tensorflow - Neural Net Lab

Leave a Reply