Python has cemented itself as one of the most important programming languages in the world today. It is widely used for cybersecurity, artificial intelligence, machine learning, deep learning, scientific computing, and general application development. The versatility, simplicity, and vast ecosystem of Python have made it a go-to language for programmers across many disciplines.
For Python developers and data scientists, having Conda in your toolkit is almost a necessity these days. It makes dependency and environment management seamless. With Conda, you can quickly install, run, and update the libraries your projects need. You can also easily create isolated environments, enhancing reproducibility across projects.
In this comprehensive guide, we will walk through how to install the Conda package manager on Ubuntu 23.04. We will cover steps like downloading the installer, verifying its authenticity, executing the install script, and updating your system PATH. Whether you are completely new to Conda or looking to install it on an Ubuntu machine, this guide will have you up and running with Conda quickly.
Table of Contents
What is Conda?
Conda is an open-source package manager and environment manager primarily used for Python. It was created in 2012 by Continuum Analytics (now Anaconda Inc.) to support the Python data science ecosystem.
Some key features and capabilities of Conda include:
- Installation of packages and dependencies – Conda makes it easy to find and install Python packages as well as other languages like R, Ruby, and C/C++. If a package has dependencies, Conda will install those automatically.
- Environment management – Conda allows you to create separate environments for each project with isolated dependencies. This improves the reproducibility and portability of projects.
- Distribution of binaries – Conda installs pre-built binaries for most packages rather than building from source code. This makes installation faster and more efficient.
- Cross-platform – Conda works consistently across Windows, macOS, and Linux operating systems.
- Language agnostic – Although focused on Python, Conda can manage packages for many programming languages.
The 2 Main Distributions of Conda
There are two main distributions of Conda:
- Miniconda – A minimal installer that includes only Conda, Python, and a few other core packages – around 400MB.
- Anaconda – A larger distribution that includes Conda plus over 150 popular Python packages for data science like NumPy, Pandas, and SciPy – requires 3GB or more.
Confused! Let’s understand how Conda, Miniconda, and Anaconda differ from one another and which one is the better choice for you.
How Conda, Miniconda, and Anaconda differ from one another (Image Source: Planemo documentation)
As we said earlier, Conda refers to the open-source package manager and environment manager software. Miniconda and Anaconda are two different distributions that include Conda, along with varying amounts of additional content.
Miniconda contains the bare minimum needed to use Conda – it includes only Conda, Python, and a small number of other essential packages, totaling about 400MB. With Miniconda, you get the Conda package and environment manager but without any extra modules or libraries installed.
Anaconda, on the other hand, includes Conda plus over 150 of the most popular Python packages for data science, math, engineering, and machine learning. This includes useful libraries like NumPy, Pandas, Matplotlib, and many more, totaling over 3GB.
The key difference between the two distributions is that Miniconda comes as a lightweight base install, while Anaconda provides a full-featured data science platform out of the box.
For most data scientists, analysts, and engineers, Anaconda is likely the better option as it comes preloaded with all the most common data analysis and machine learning libraries like SciPy, scikit-learn, and Jupyter Notebook. This allows you to bypass installing each individually. The larger size may be a downside for limited storage, however.
For developers who want only the Conda package manager and wish to hand-pick additional packages later, Miniconda is preferable. The minimal install allows you to keep disk usage lower.
The final verdict is that Anaconda is recommended for those looking to get started with data science in Python, as it contains everything you need. Miniconda is suited for developers who want control over each package installed. Both provide the Conda package and environment manager to manage Python and other language distributions.
Prerequisites to Install Conda
You can’t get Conda alone to install. You should install either Miniconda or Anaconda to get Conda on your machine. Before installing Miniconda or Anaconda on your system, ensure your computer meets the following minimum software and hardware requirements:
- 32-bit or 64-bit system architecture
- For Miniconda – Minimum 400 MB disk space
- For Anaconda – Minimum 3 GB disk space
- Ubuntu 18.04/20.04 or Debian 9/10
- User privileges to install software
- Internet connection to download the installer
- x86_64 / amd64 (common desktop processors)
- ARM64 (Raspberry Pi and other devices)
- PowerPC64le (rare specialist hardware)
As long as your system satisfies those prerequisites, you are ready to install Conda!
In terms of hardware, Conda does not require any specialized components. It can run on most standard desktops, laptops, or cloud virtual machines that fulfill the above software requirements.
Both Miniconda and Anaconda support the common x86_64/amd64 CPU architecture used in most desktops and laptops. Other CPU architectures like ARM64 on Raspberry Pi devices are also supported.
That covers the core requirements to install either distribution of Conda on Linux, Windows, or macOS. As long as your system satisfies the appropriate software versions and has sufficient disk space, you are ready to install Conda with either the minimal Miniconda or full-featured Anaconda.
How to Install Conda on Ubuntu Linux?
Installing Conda on Ubuntu, Debian, or other Debian-based Linux distributions is straightforward. In fact, the installation of Conda on other Linux distributions like CentOS, Fedora, RHEL, and Arch Linux is not quite different.
Step 1: Download the Conda Installer Script
The first step is to download the appropriate installer script for your system. Go to the Miniconda or Anaconda downloader page and copy the link for the installer matching your architecture and Python version.
Miniconda download page: https://docs.conda.io/projects/miniconda/en/latest/
Anaconda download page: https://www.anaconda.com/download/
We have Ubuntu 23.04 LTS as our demo machine. We are going to download the anaconda on Ubuntu 23.04 using the wget utility to download the installer file. We are going to download the Anaconda installer file in the Downloads directory.
Commands to download Anaconda:
Commands to download Miniconda:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh
The same process applies to 32-bit systems. Select the correct installer link to download. For other distros like CentOS, RHEL, Fedora, or Arch Linux, follow the same command to download the Miniconda or Anaconda installer script for your architecture.
Step 2: Verify the Hash of the Anaconda Installer Script
Before executing the downloaded script, you should verify it matches the expected hash provided on the Miniconda or Anaconda downloads page. Comparing the hashes ensures your download was not corrupted or tampered with in transit.
Get the hash for the installer you downloaded from the website. Then run the following command, substituting the hash and filename:
echo “hash_for_your_file name_of_downloaded_file” filename | sha256sum –check
For example, with the Anaconda script:
echo "589fb34fe73bc303379abbceba50f3131254e85ce4e7cd819ba4276ba29cad16" Anaconda3-2023.07-2-Linux-x86_64.sh | sha256sum --check
Step 3: Make the Installer Executable and Run It
The Conda installer script will not run until it has executed permissions. Use the
chmod command to make the script executable:
Follow the prompts to accept the license agreement, specify an install location (default is ~/anaconda3), and choose whether to allow init. The script will automatically install Conda and any included packages.
The process is the same for the Miniconda installer script and other Linux distributions.
Step 4: Add Conda to Your PATH Environment Variable
This step is not required if you initialize the Conda during the final step of the installation process. These below lines are auto-added if you initialize the conda as part of the installation process. Make sure you have these lines added to /home/<user>/.bashrc file to call conda from anywhere in your terminal.
# >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/home/arunkl/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/home/arunkl/anaconda3/etc/profile.d/conda.sh" ]; then . "/home/arunkl/anaconda3/etc/profile.d/conda.sh" else export PATH="/home/arunkl/anaconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<<
If not, Conda will not be available system-wide after installation. To call Conda commands from any location, you need to add the path to the Conda binaries to your PATH variable.
Add the following lines to your ~/.bashrc file:
# For Anaconda: export PATH="/home/user/anaconda3/bin:$PATH" # Add Miniconda to PATH export PATH="/home/user/miniconda3/bin:$PATH"
You can add the below 3 lines to the .bashrc file located in your home directory. Use your favorite editor to add these lines to /home/<user>/.bashrc file. We use nano editor to check it out.
Now Conda commands like
conda install or
conda create can be run from any directory. Without this, you would need to always call Conda relative to the install location.
Step 5: Test the Conda Installation
To verify Conda installed correctly, first check the version with:
This should print the Conda version number without errors.
You can also test it by listing installed packages:
For Miniconda, this will only show core packages like Python and Conda itself. The full Anaconda distribution will list over 150 data science packages.
conda --version or
conda list run successfully, then congratulations – you now have a working Conda installation on your Ubuntu or Debian system!
You can now use Conda to manage packages, environments, and distributions for Python as well as other languages like R, Ruby, and C/C++.
This process works for installing Miniconda or Anaconda across all common Linux distros. Just be sure to use the correct architecture installer and verify the hash before executing.
Installing Conda on Linux gives you access to a powerful package manager for Python, R, Ruby, and other languages. As we saw in this guide, the process is relatively straightforward across Ubuntu, Debian, CentOS, Fedora, and other common distributions.
By following the steps to download the correct Miniconda or Anaconda installer, verifying its integrity, executing the script, and updating your PATH, you can get up and running with Conda quickly. The installation process only takes a few minutes.
With Conda now on your system, you have an efficient way to install and manage software packages without dependency hassles. You can also easily create isolated Conda environments for each of your development projects, enhancing reproducibility.
Overall, Conda is a valuable addition for Python data scientists and developers working on Python. It streamlines package management and environment configuration – two areas that can often cause friction in projects.
We hope this guide gave you a clear overview of how to download, install, and configure Conda on your Linux distribution of choice. Conda opens up easier package management and environment control for your Python projects. Let us know if you have any other questions in the comments section below as you get started with Conda!