Python Anaconda - How to Safely Uninstall
Effortlessly remove Anaconda, first by utilizing anaconda-clean
to remove config files, then eradicating its primary directory. Here are the steps:
- Purge configurations using
anaconda-clean
:conda install anaconda-clean && anaconda-clean --yes # Treat your system to a cleaning spree!
- Delete Anaconda's root directory (
~/anaconda3
on Unix-like systems orC:\Users\<Username>\Anaconda3
on Windows):rm -rf ~/anaconda3 # Unix-like rmdir /S /Q C:\Users\<Username>\Anaconda3 # Windows
- Update your system's PATH -- this removes Anaconda's directories.
Remember to create a backup to store important files before proceeding.
Wiping configurations post-uninstall
Following the erasure of the Anaconda directory, it's important to ensure leftover configurations are also wiped out. Check and modify files pertaining to the shell's initialization e.g., ~/.bash_profile
or ~/.bashrc
on Unix-like systems, or C:\Users\<Username>\.bash_profile
on Windows, to remove residues of Anaconda's PATH entries.
Moreover, hidden directories like .condarc
, .conda
, and .continuum
may hide lingering settings or historic data. Remove them as well.
Refresh system configurations by running which python
(Unix-like) or where python
(Windows) to validate that your default Python executable isn't managed by Anaconda. Rebooting your system or restarting the shell with source ~/.bashrc
, or by opening a new command prompt window on Windows, will fully sync these changes.
Verification of complete Anaconda removal
To confidently verify that Anaconda has indeed left the building, try invoking the conda
command or any related tools. If you receive a "command not found" error, congratulations! You've evicted Anaconda!
When using rm -rf
, carefulness is key; it's like wielding a lightsaber -- it can help you defeat Sith lords or accidentally chop off your own hand. Hence, it's essential to prevent any unintended loss of critical files or directories.
Ensuring a clash-free future
After uninstalling Anaconda, if your goal is to transition back to your system's default Python setup, cleaning the slate of lingering PATH elements is a must. Specifically, make sure no traces of Anaconda lurk around in files that get read and executed at each shell session, namely .bash_profile
or .bashrc
.
Taking the time to create backups of these profiles before making changes is like a safety net, it might save your day should the skies turn cloudy!
Scenario handling: Backup and anaconda-clean
Even if you want to say goodbye to Anaconda for now, keeping a backup of your Anaconda directory could come in handy -- who knows when you might want to revisit some old configurations? Or if you decide to reinstall Anaconda a month later?
Anaconda ships with anaconda-clean
, a utility that removes most Anaconda-related files and directories. Running anaconda-clean --yes
ensures a smooth departure.
Restoring system python
Once Anaconda is out of the picture, getting your system's Python interpreter up and running again as the default might be necessary. Depending on your needs, you might want to reinstall Python. In macOS, remember that python
tends to point to Python 2.7, while python3
indicates Python 3.x.
Was this article helpful?