We like Python. Anaconda is a popular distribution of Python and the R programming languages, which includes package management and deployment tools, with hundreds of packages pre-installed.
Anaconda is aimed at data scientists and people working with machine learning, but it’s useful for anyone. It has a quick and easy install process for Ubuntu, so here’s how to get up and running!
Download the Anaconda installer
Anaconda has various additions, and we want the Open Source (free!) individual edition, available from:
https://www.anaconda.com/products/individual
Scroll down and download the 64-Bit (x86) Installer into its own directory, or use the shell commands below:
mkdir ~/anaconda-installer cd ~/anaconda-installer wget https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
The download may take a few minutes.
Run the Anaconda Installer
Now that the installer has downloaded, run it:
sh Anaconda3-2020.11-Linux-x86_64.sh
Press ENTER to read the license agreement (keep tapping enter to keep scrolling through it) and type ‘yes’ when prompted to accept and continue.
Press ENTER to accept the default install directory (or change it first if you’d prefer it be installed somewhere else).
When asked whether to run conda init, enter ‘yes.’
This will update your
.bashrc
file to make the conda command accessible on your PATH (this means Anaconda commands will be available in your shell no matter which folder you’re currently navigating).
For these changes to take effect – close and reopen your terminal, reboot, or run:
. ~/.bashrc
You can now delete the directory we downloaded the installation files to;
rm -rf ~/anaconda-installer
Checking the Installation
To check everything is installed and accessible, run:
conda --help
If everything is working, you should see some helpful text.
If You’re on a System with a GUI
If you are using a GUI (i.e., a computer with a desktop interface, rather than running on a server or accessing a computer remotely via SSH), you can try out the Anaconda Navigator – a graphical tool for managing Anaconda.
Simply run:
anaconda-navigator
…in your terminal.
Updating Anaconda
To update all of your Anaconda packages, run:
conda update --all
… and press Y to accept the changes.
Completely Uninstalling Anaconda
To completely uninstall Anaconda, first install the anaconda-clean package for Anaconda to aid in the cleanup of all Anaconda files and configuration:
conda install anaconda-clean
To delete all files and directories created by Anaconda, without being prompted to confirm each file deletion, run:
anaconda-clean --yes
anaconda-clean will remove all files at their current locations and leave a backup copy of them in the directory ~/.anaconda_backup.
This backup directory, and the directory containing the Anaconda program files, can now be removed:
rm -rf ~/anaconda3 ~/.anaconda_backup
Note: This process will not delete the AnacondaProjects directory.
During the setup process, conda init will have made some changes to your ~/.bashrc file, which can be undone by removing the lines from that file manually using the nano text editor:
nano ~/.bashrc
Delete the Anaconda lines highlighted below: