Uninstall Python on Linux

This guide will instruct on uninstalling the Anaconda Python distribution and purging the computer of old configuration files which can be problematic. The instructions can be used to uninstall Miniconda/Miniforge and Mambaforge which all leave similar configuration files behind.

Go to the Home folder. Select options and Show Hidden Files:

The Prompt in the Terminal will be prefixed with (base) from previously initialised Anaconda/Miniconda/Miniforge/Mambaforge installations:

To run a commmand as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

(base) philip@pc:~$

Close down any open Terminals. Then open up the .bashrc file in the text editor:

Remove the conda initialise code block which should look like the following:

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/philip/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/home/philip/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/home/philip/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/home/philip/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

Save the file. When the terminal is opened it should look at the updated .bashrc file and the prompt should now exclude the prefix (base):

To run a commmand as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

philip@pc:~$

Delete the folder(s):

  • anaconda3
  • miniconda3
  • miniforge
  • mambaforge

Delete the following hidden configuration folders:

  • .amaconda
  • .conda
  • .continuum
  • .ipython
  • .jupyter

Delete the file:

  • .condarc

Having an old version of this file from a previous Anaconda installation and then installing Mambaforge for example without deleting this file may result in the mamba package manager using the wrong channel (conda instead of conda-forge) which can be problematic.

Go to the folder:

  • .config

Do not delete this folder as it is used by Linux and other programs.

Delete the subfolders:

  • matplotlib
  • spyder-py3

The folder options can be used to Hide Hidden Files:

This gives a clean Linux Operating System to install Mambaforge or an updated version of Anaconda.