Here is the step-by-step guide to uninstall PyTorch with Anaconda.
Step 1: Activate your Anaconda environment
Activate your Anaconda environment (if you have one specifically for PyTorch). If you don’t have a specific environment, you can skip this step.
conda activate your_environment_name
Step 2: Use the conda command to uninstall PyTorch
conda uninstall pytorch
Step 3: Uninstall other PyTorch-related packages
If you also installed torchvision or torchaudio (commonly used alongside PyTorch), you can also uninstall them.
conda uninstall torchvision torchaudio
Step 4: Verify the Uninstallation
To verify that PyTorch has been uninstalled, we can use the following command to list all the packages installed in the environment.
If PyTorch is no longer listed in the output, it has been uninstalled successfully.
Step 5: Deactivate the environment if you have activated it
Note: Always back up any essential data or configurations before uninstalling any package to prevent accidental data loss.
Alternate ways to uninstall PyTorch with Anaconda
You can directly uninstall PyTorch with conda uninstall using this command:
conda uninstall pytorch torchvision cuda80 -c soumith
To uninstall PyToch with Anaconda, “run conda uninstall pytorch torchvision torchaudio command to remove PyTorch and associated libraries.”