How to install Anaconda on Ubuntu 20.04

s2 0

Anaconda is a popular Python / R data science and machine learning platform used for large scale data processing, predictive analysis, and scientific computing.

The Anaconda distribution comes with 250 open source data packages, and more than 7,500 additional packages can be installed from the Anaconda repositories. It also includes the conda Command line tool and a graphical desktop user interface called Anaconda Navigator.

This tutorial will walk you through installing the Anaconda Python distribution on Ubuntu 20.04.

Install anaconda

At the time of this writing, the latest stable release of Anaconda is 2020.02. Before downloading the installation script, visit the Download page
and see if a new version of Anaconda for Python 3 is available for download.

To install Anaconda on Ubuntu 20.04, do the following:

  1. Anaconda Navigator is a QT based GUI. If you want to install Anaconda on a desktop computer and use the GUI application, install the following packages. Otherwise, skip this step.

    sudo apt install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6
  2. Download the Anaconda installation script with your web browser or wget

    wget -P /tmp

    The download may take some time depending on the connection speed.

  3. This step is optional, but it is recommended that you verify the data integrity of the script.

    Use the sha256sum Command to display the script checksum:

    sha256sum /tmp/

    The output should look like this:

    2b9f088b2022edb474915d9f69a803d6449d5fdb4c303041f60ac4aefcc208bb  /tmp/

    Make sure the hash printed from the command above matches the hash available in the Anaconda with Python 3 on 64-bit Linux side
    for your corresponding Anaconda version.
  4. Run the script to start the installation process:

    bash /tmp/

    You should see output like this:

    Welcome to Anaconda3 2020.02
    In order to continue the installation process, please review the license
    Please, press ENTER to continue

    Press ENTER keep going. To scroll through the license, use the ENTER Key. After reviewing the license, you will be prompted to approve the license terms:

    Do you approve the license terms? [yes|no]

    Type yes to accept the license and you will be asked to choose the installation location:

    Anaconda3 will now be installed into this location:
        - Press ENTER to confirm the location
        - Press CTRL-C to abort the installation
        - Or specify a different location below

    The default location should be fine for most users. Press ENTER to confirm the location.

    The installation may take some time and when it is finished the script will ask if you want to run it conda init. Type yes.

    Installation finished.
    Do you wish the installer to initialize Anaconda3
    by running conda init? [yes|no]

    This will add the command line tool conda to your system PATH

    To activate the Anaconda installation, you can either close and reopen your shell or load the new one PATH Environment variable into the current shell session by typing:

    source ~/.bashrc

    How to check the installation type conda in your terminal.

That’s it! You have successfully installed Anaconda on your Ubuntu computer and you are ready to use it.

If you installed Anaconda on a desktop system, open the Navigator GUI by typing anaconda-navigator in your terminal:

Updating Anaconda

Updating the anaconda is a pretty straightforward process. Open your terminal and enter:

conda update --all

When there are updates conda displays a list and asks you to confirm the update:

The following packages will be UPDATED:

  anaconda-navigator                          1.9.12-py37_0 --> 1.9.12-py37_1
  conda                                        4.8.2-py37_0 --> 4.8.3-py37_0
  conda-package-han~                   1.6.0-py37h7b6447c_0 --> 1.6.1-py37h7b6447c_0

Proceed ([y]/n)? 

It is a good idea to update your Anaconda installation regularly.

Uninstalling Anaconda

If you want to uninstall Anaconda from your Ubuntu system, remove the Anaconda installation directory and any other files that were created during the installation:

rm -rf ~/anaconda3 ~/.condarc ~/.conda ~/.continuum

Open that ~/.bashrc
File and remove the anaconda directory from the PATH Environment variable:

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


We showed you how to install Anaconda on Ubuntu 20.04. You should check out the officer now First steps with conda

If you run into any problem or have any feedback, please leave a comment below.