How to Install Anaconda on Ubuntu 22.04?
Are you thinking about embarking on Python, data science, or machine learning on Ubuntu but have no idea where to begin from? You are in the right place! In this article, I will show you step by step (it’s for beginners) how to install Anaconda on Ubuntu 22.04. There is no fluff, no tech-heavy language, just a simple and easy path to the finish line to get you your Anaconda installed.
Whether you are a developer, data scientist, or want to wander into the world of AI, Anaconda is a great way to manage your Python packages and environments.
What is Anaconda and Why Use It?
Before we get into the installation details, here’s a quick summary:
Anaconda is an open-source distribution of Python and R and comes with many useful features for:
- Data Science
- Machine Learning
- Deep Learning
- Big Data Analytics
- Scientific Computing
It includes conda, a package and environment manager, and it has libraries, like NumPy, Pandas, Jupyter, Matplotlib, and many more, which are preinstalled.
Prerequisites
To follow this tutorial, you’ll need:
- A machine running Ubuntu 22.04 LTS
- A terminal window
- sudo privileges
Step 1: Update Your System
It is best to update your packages with this command before installing anything:
sudo apt update && sudo apt upgrade -y
Step 2: Download the Latest Anaconda Installer
Head to the official Anaconda download page and grab the latest Linux installer link.
Then run:
cd /tmp curl -O https://repo.anaconda.com/archive/Anaconda3-2023.07-2-Linux-x86_64.sh
It downloads the .sh installer script to your system.
Step 3: (Optional) Verify the Installer
You can verify the integrity of the file by checking its SHA-256 hash:
sha256sum Anaconda3-2023.07-2-Linux-x86_64.sh
Compare this output with the hash listed on the official site.
Step 4: Run the Anaconda Installer
Now, let’s install Anaconda:
bash Anaconda3-2023.07-2-Linux-x86_64.sh
You’ll be prompted to:
- Review and accept the license terms
- Choose an install location (default is ~/anaconda3)
- Initialize Anaconda (say yes)
Take your time reading, and follow the on-screen instructions.
Step 5: Activate Anaconda
After installation, activate Anaconda with:
source ~/.bashrc
Then verify it’s working:
conda --version
You should see something like:
conda 23.7.4
Congrats, you’ve got Anaconda installed on Ubuntu 22.04!
Step 6: Update Conda
Make sure everything is up to date:
conda update conda
You can also update the full Anaconda distribution with:
conda update anaconda
Step 7: Create a Virtual Environment (Optional but Recommended)
Isolating environments helps you avoid package conflicts. Here’s how to create one:
conda create --name myenv python=3.10 conda activate myenv
Replace myenv with whatever name you prefer. You now have a clean space to work on your projects.
How to Uninstall Anaconda (Optional)
If you ever want to remove Anaconda completely:
1. Install cleanup utility:
conda install anaconda-clean
2. Run cleanup:
anaconda-clean --yes rm -rf ~/anaconda3 ~/.condarc ~/.conda ~/.continuum
3. Remove Anaconda lines from .bashrc and reload:
nano ~/.bashrc source ~/.bashrc
Pro Tips for Using Anaconda on Ubuntu
- Use conda list to view installed packages.
- Use conda install package_name to add new ones.
- Want to launch a Jupyter Notebook? Just type:
- jupyter notebook
Final Thoughts
The installation process of Anaconda on Ubuntu 22.04 is very simple, and once it is installed, you are ready to start analyzing stakeholders’ data, working on AI/Self-learning software development, or just trying out Python to see what it can do. Whether you are building machine learning models, or conducting scientific or mathematical computations, Anaconda reduces the effort because you have packages, dependencies, and environments all handled in a unified system.
Frequently Asked Questions FAQs
1. Is Anaconda better than installing Python via apt?
Yes, Anaconda provides pre-packaged libraries, an environment manager, and tools like Jupyter, which are not available with plain Python.
2. Does Anaconda work on WSL or Ubuntu on Windows?
Absolutely! You can follow the same steps on WSL with Ubuntu 22.04.
3. How do you install Anaconda in a custom directory?
Just specify the path during installation when prompted.
4. How do I update Anaconda itself, not just conda
You can update the entire Anaconda distribution using:
conda update anaconda
It ensures all core packages and dependencies are up to date.
5. Is Anaconda secure to use?
Yes, Anaconda is maintained by reputable developers and organizations. Always download it from the official Anaconda site or repo.anaconda.com.
6. Can I install Anaconda if I have a server or cloud VPS (AWS, Linode, DigitalOcean, etc.)?
Absolutely! Anaconda works perfectly on cloud VMs. Just connect SSH into your server and follow the same installation steps.
7. Can I install Anaconda if I have system Python, or can I install Anaconda alongside system Python?
Yes. Anaconda comes with its own version of Python which is installed in a separate directory; therefore, Anaconda will not interfere with your system Python.