How to Install Anaconda on Ubuntu 22.04?
Anaconda is a widely used open-source data science platform that makes package and environment management easier for Python and R. It is best suited for beginners looking for data science and machine learning projects. Additionally, Anaconda provides nearly 1000 data science packages and is available in both paid and free versions.
Are you looking to start your journey on data science, or machine learning on Ubuntu? But, have no idea where to start from? Then, you’ve landed at the right place!
Here, in this guide, we will help you with the step-wise guide to install Anaconda on Ubuntu 22.04!
What is Anaconda?
Anaconda is an open-source distribution of Python and R that offers many advanced features like data science, machine learning, big data learning, scientific computing and much more. However, it also has a few pre-installed packages like Numpy, Scipy, PyTorch and Transformers.
Top Reasons to Choose Anaconda
- Opt for Anaconda if you’re working on large projects and require many packages.
- The system has enough storage capabilities.
- Do not have more knowledge about the project & the tools required.
- Get everything installed at once.
Steps to Install Anaconda on Ubuntu 22.04
Let’s go through a few basic steps to install Anaconda on Ubuntu 22.04!
Method 1: Normal Installation
Step 1: Access the Server via SSH
Run the following command to access the server via SSH.
ssh user@server-ip
Enter the username and IP address instead of user and server ip.
Step 2: System Updates
Ensure updating your packages before installing anything.
apt update && apt upgrade -y
As a result, it helps prevent any error during installation.
Step 3: Create a non-root user.
It is advisable to create and switch to a non-root user as it eliminates the chances of risk caused during accidental changes.
adduser demo-user usermod -aG sudo demo-user su - demo-user
Step 4: Download the Anaconda Installer
Make sure that you download the Anaconda installer via wget. You can get the latest Anaconda version from the official website.
Move to /temp directory, hence keeping the directory clean.
cd /tmp
Now, download the installer script and rename it.
wget -O anaconda.sh
Step 5: Verify it
Ensure that the script runs correctly during the installation process.
sha256sum anaconda.sh
Step 6: Install Anaconda
To carry out the installation process, run the following command!
bash anaconda.sh
Once the installation is complete, you will be encouraged to initialize Anaconda.
Method 2: Silent Installation
To carry out non-interactive and quick installation, you are required to use the silent mode with -b batch mode.
bash anaconda.sh -b
Step 7: Initialize Anaconda
If you have started with the interactive mode and stated no to auto-initialization, then run:
source <Path_to_conda>/bin/activate
As a result, the Anaconda is activated.
To add the shell functions, now run the following command:
conda init
If set to yes, it will be initialized automatically. Then, you need to open another terminal or refresh the current terminal to change the bash file.
source ~/.bashrc
When the installation is carried out using the silent mode, use the following command:
source <Path_to_conda>/bin/activate
Now, you need to add Anaconda’s shell functions using:
conda init
If you do not require having a base environment activated, you need to disable it using the following command:
conda config --set auto_activate_base False
Conda will not automatically activate the base environment when opening a new terminal. To do so manually, run the following:
conda activate
Step 8: Verify Installation
Verify the installation using the following:
conda info
Update Anaconda
After the installation, to update it to the latest version run the following:
conda update conda
Uninstall Anaconda
To uninstall Anaconda, run the following command:
rm -rf ~/anaconda3
That’s it!
Final Wrap Up
Installing Anaconda on Ubuntu 22.04 is simple, straightforward and can be carried out in a few simple steps. The newbies or developers can easily start working on varied projects like machine learning, data science, and many more. Hence, having Anaconda installed eliminated the efforts of getting individual packages and handled all packages under a single unified system.
Frequently Asked Questions
Is it possible to install Anaconda along with an existing Python installation?
Yes, Anaconda facilitates the easy creation of separate Python environments. Additionally, one can easily install Anaconda without affecting the existing Python installation.
What needs to be done to update an Anaconda?
To update an Anaconda, you need to run the following command:
conda update conda
How can I uninstall an Anaconda?
To uninstall an Anaconda, run the following command:
rm -rf ~/anaconda3