pytorch

How to Uninstall PyTorch

PyTorch is an extensive framework with a long list of capabilities designed to efficiently take on modern machine learning tasks. Its hardware requirements are similarly considerable. Developers or data scientists who do not have much use for it intend to “uninstall” it from their IDEs, such as “Conda”, to increase the volume of space available, install a different version, or to increase processing speeds for their projects.

In this article, we will discuss how to uninstall PyTorch.

How to Uninstall PyTorch?

A user may have to uninstall the PyTorch framework for any number of reasons such as installing a newer version or freeing up disk space. The Anaconda IDE will be used in this tutorial. It is most popular amongst data scientists because of its many Python features and packages.

Follow the steps given below to uninstall PyTorch from Conda:

Step 1: Install Anaconda

Download the Mac or Windows “.exe” file for Anaconda from their website and follow the steps of the installation wizard to properly install it onto the system.

Step 2: Open the Anaconda Prompt in the Windows OS

After the installation process is complete, go to the Start Menu and type in “Anaconda Prompt” and click on it:


The following prompt dialog box opens:


Step 3: Check Anaconda Version

An important step to take after installing Anaconda is to check its version in order to avoid any code incompatibilities. Use the following prompt to check which version is available in the Anaconda Prompt:

conda -V

 
The Conda installed version “23.5.2” can be seen in the screenshot:


Step 4: Uninstall PyTorch from Conda

Next, PyTorch is to be uninstalled from Conda. Enter the following command to remove PyTorch from the list of Conda Packages:

conda uninstall pytorch

 

Step 5: Check if PyTorch is Uninstalled or Not

The last step is verification for PyTorch uninstallation. In order to do this, use the following prompt to print all the available Conda packages:

conda list

 
The list of all Conda packages shown below that does not contain PyTorch:


PyTorch is not available which means we have successfully uninstalled it from Conda:

Pro-Tip

In addition to a simple uninstallation, PyTorch can also be completely removed from the system by using the “remove” command. This can free up crucial space in the hard drive by deleting all cache files.

Success! PyTorch has been uninstalled from Conda and it no longer shows up in the list of available packages.

Conclusion

To uninstall PyTorch, utilize the “conda uninstall pytorch” command in Anaconda Prompt and verify its uninstallation by listing all installed packages.. The uninstallation will delete cache files and stop any background processes that slow down the system. This will increase available space on the hard drive and free up memory. In this article, the focus has been on how to uninstall PyTorch from the Anaconda IDE.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.