Today I will walk you through the steps to install and set up anaconda on Ubuntu 20.04. The steps are very easy to follow so you won’t have any problem installing anaconda on your ubuntu system.
Create a new directory for Anaconda
Now, let’s start the installation process. The first step will be to create a new directory in our home directory where Anaconda will be downloaded. Just to keep things organised.
To create a new directory using the terminal use this command –
mkdir -p anaconda
Here, the “anaconda” is the name of the directory which you can name anything that you like.
You can also create a new directory by going to your File Manager>Home. After that right-click inside the Home directory and click on “New Folder”.
Name the folder “anaconda” and then click on create.
Download Anaconda
Now, the next step will be to download Anaconda from its official website Anaconda.com. There are two ways to download anaconda, you can download it directly from its website or you can download it using the terminal.
Download Anaconda using Browser –
Let me show you both the ways to download anaconda. First I’ll show you how you can download anaconda directly from its website using a web browser.
- Go to https://www.anaconda.com/products/individual#Downloads on your web browser and select the version of anaconda you want to install.
- Click on the 64-bit(x86) Installer. In the firefox download popup select “save file” and click “OK”. This will start the download of Anaconda.
By default, the file will be downloaded to the Downloads folder. You will need to right-click the downloaded .sh file and then click on “move”. Then select the new anaconda folder that you created and move the downloaded .sh file to that folder.
Download Anaconda using Terminal –
Now, let’s see the steps to download Anaconda using the terminal. First, change your working directory to the directory where you want to download Anaconda.
In our case its the folder that we created in the first step, so we will change our directory to that one using this command –
cd anaconda
After changing the working directory we’ll download anaconda to that directory using this command –
wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
If you don’t have wget installed on your ubuntu system then you can install it using “apt-get install wget”.
Note: The download link keeps changing after the latest updates, so the above command might not work after some time. It’s better to just download anaconda using the web browser or get the latest download link from here.
Install Anaconda on Ubuntu 20.04
Before starting the installation process we will have to first “Verify the data integrity with SHA-256”.
To do that, first go to https://docs.anaconda.com/anaconda/install/hashes/. Here click on the “64-bit Linux py3 ”.
I have python 3 installed on my ubuntu that’s why I have selected the py3 option, if you have python 2 then select the py2 one.
After that click on the version of anaconda that you downloaded. In our case it will be – “Hashes for Anaconda3-2021.05-Linux-x86_64.sh” this will be different if you downloaded a different version of anaconda. Check the downloaded file for the version name.
Now here you will need to copy the hash shown at the right side of “sha256”. Copy it and paste it somewhere, we’ll need it after this step.
Before proceeding to the next step, change your working directory to home directory. As our working directory was anaconda.
cd ~
Now in the terminal, you will have to type this command – “sha256sum /1path/username/2path/filename” where 1path will be home, the username will be your username, 2path will be anaconda folder, the filename will be the name of the downloaded anaconda.sh file.
sha256sum /home/username/anaconda/Anaconda3-2021.05-Linux-x86_64.sh
Now after you enter this command in your terminal, there will be a hash shown in the terminal which you will need to compare with the hash shown on the website.
If it matches then continue to the next step to install anaconda on ubuntu 20.04.
Now, change your working directory to anaconda by using this command –
cd anaconda
After that in the terminal type “bash filename”. The file name will be the name of the anaconda file that you downloaded.
bash Anaconda3-2021.05-Linux-x86_64.sh
Press Enter, this will start the installation process.
First press “enter” to continue then it will ask you to read the terms and agreement, hold and keep pressing enter to continue.
Once the Agreement ends it will ask you to accept it. Enter “Yes” to continue. After accepting the agreement it will show you the location where anaconda will be installed. Press Enter to continue.
It will take some time to finish the installation of anaconda, just before the installation finishes it will ask whether “You wish the installer to initialize Anaconda3 by running conda init”. Enter “Yes” to finish the installation of Anaconda on ubuntu.
Now you will need to run the source command or close the activate terminal and open a new terminal window for anaconda to work.
Type this command to verify the installation of Anaconda –
conda --version
Finish Anaconda Setup
Now after installing anaconda, by default every time you open a new terminal, your terminal will have the base environment activated with it like “(base) [email protected]:~$” in the terminal.
Which you can activate or deactivate by using the command shown below.
conda config --set auto_activate_base True
Or
conda config --set auto_activate_base False
Here, if you set it “True” then new terminal windows will have the base environment activated automatically. If you set it “False” then it won’t. Close the terminal and open a new one to see the change.
If this post helped you in installing anaconda then be sure to share it with others that need it. If you are facing any problem while installing anaconda then comment below or contact me through email at – [email protected]. Thank you.
[lyte id=’ezxtBEYAHsk’ /]
FAQ –
Q1. How to Uninstall Anaconda on Ubuntu 20.04?
You can uninstall Anaconda by typing “rm -rf ~/anaconda3” in the terminal. If you want to fully uninstall Anaconda and its related files then in a terminal type “conda install anaconda-clean” and after that type “anaconda-clean –yes”.