Anaconda is a Python distribution that is primary used for applications that are related to data science and machine learning. Just like Python it comes with its own package manager named as conda, the interesting part is that it also comes with its GUI version named as Anaconda Navigator. On Ubuntu, both of its versions can be installed via anaconda installer.
2- Ways to Install Anaconda on Ubuntu
Anaconda not only provides package management but also helps in environment management and comes with pre-installed packages. Further, using the anaconda you can get access to many community-contributed packages via conda-forge.
1: Through Anaconda Installer(CLI)
The first way to install Anaconda on Ubuntu is using its execution file, which you can download by visiting the download section of Anaconda. First fill in the email for to get the download link, it will either redirect you to the download page or will send you the download link to the email:
Once you have submitted your email, you need to download the file by clicking on the Download button:
Alternatively, if you can use the below command to download the bash file for Anaconda via terminal:
wget https://repo.anaconda.com/archive/Anaconda3-2024.06-1-Linux-x86_64.sh
Once the file is downloaded, you need to verify the integrity of the downloaded file using the SHA-256 command, which ensures that the downloaded installer hasn’t been tampered with and is safe to use.
sha256sum Anaconda3-2024.06-1-Linux-x86_64.sh
Now, execute the bash file for Anaconda by executing the below command:
bash Anaconda3-2024.06-1-Linux-x86_64.sh
Here, first the terms and conditions for anaconda will be displayed and to move further in terms and condition press enter:
Once you have read the terms and conditions, enter yes:
The next thing Anaconda installer will ask, will be the directory for its installation, you can either path for the desired directory here or simply press enter if you want to go with the current directory:
Now at the end Anaconda installer will ask you to deactivate the shell, so for that enter yes:
Here you will see the message for successful installation of anaconda on Ubuntu:
Further, to verify the installation of Anaconda you can check its details by executing the below command:
conda info
To detective the anaconda shell in Ubuntu, use the following command:
conda deactivate
Here, I have installed the latest version of Anaconda for Linux, however you can install the older versions as well and for that you need to visit anaconda archives:
2: Through Anaconda Navigator (GUI)
There is also a GUI version of Anaconda as well which is known as Anaconda Navigator, this is useful if you are not good with using commands. To install Anaconda navigator on Ubuntu, you need to install its command line version and then execute the below command:
conda install anaconda-navigator
To launch Anaconda navigator on Ubuntu, you need to switch to bin directory of anadona3 using the below commands:
cd anaconda3/bin
anaconda-naviagtor
Next, in order to install packages via Anaconda, you have to connect to one of its repositories:
How To Connect to Anaconda Repositories using Anaconda Navigator
To connect to Anaconda repositories, click on Connect and then select any one of them, here for demo I am selecting the Anacodna.org:
Next, since you are connecting for the first time, you need to create an account on anaconda.org and for that click on the click here:
Now enter your details and after that agree to its terms and conditions, afterwards click on Register for Free:
After that you will receive the conformation or verification of account email, verify the account and then login to Anaconda Navigator. Once the Anaconda.org repository is connected, you will see its conformation in the top right corner:
Commands For Using Anaconda on Ubuntu
If you are new to Anaconda distribution in Ubuntu, then below is the table that gives some of the basic commands that you can use:
Command | Description |
conda create -n [virtual;-environment-name python=[python-version] | Creates a new environment with desired Python version. |
conda activate [Name-of-environment] | To activate the environment. |
conda deactivate | To deactivates the current virtual environment. |
conda list | For listing all the current environment installed programs/apps |
conda install [app/package-name] | To install any app or package via conda package manage. |
conda remove [app/package-name] | To uninstall or remove any application or package. |
conda update [app/package=name] | To update any specific application or package |
conda update –all | To update all packages in the current environment. |
conda info –envs | Lists all available virtual environment. |
conda create –clone [current-virtual-environmment] [name -for-new-clone] | Clones the current virtual environment to create a new one. |
Conclusion
This post discussed two ways for installing Anaconda on Ubuntu one method installs the command line version and the other installs the GUI version named as Anaconda Navigator. To install both, you need to download anaconda installer bash file. Further, for Anaconda Navigator you need to connect it to any of the anaconda repository.