Operating System Ubuntu

How to Install Anaconda Python on Ubuntu 24.04 LTS

Install Anaconda Distribution on Ubuntu 24.04 LTS, verify the installer, manage conda environments, and see when Miniconda or Miniforge is the better choice.

Anaconda Distribution bundles Python, the conda package and environment manager and several hundred data science packages in one installer. This guide installs it from the command line on Ubuntu 24.04 LTS (the steps are identical on Ubuntu 22.04), shows how to work with conda environments, and explains the licensing terms and the lighter alternatives, Miniconda and Miniforge. Ubuntu 18.04, which older tutorials covered, is past its standard support period; use a current LTS release instead.

Before you start

  • An Ubuntu 24.04 or 22.04 system, either x86_64 or ARM64 (aarch64). Anaconda publishes a separate installer for each architecture.
  • A regular user account. The examples use deploy. Anaconda installs into your home directory, so do not run the installer or conda with sudo.
  • Disk space: Anaconda's documentation puts the full distribution at roughly 9.7 GB installed, against about 900 MB for Miniconda.
  • curl, which you can install with sudo apt update && sudo apt install -y curl.

Check whether you need a paid license

Anaconda Distribution and Miniconda are covered by Anaconda's Terms of Service. According to those terms, use is free for individuals working on personal, non-commercial projects, for eligible academic institutions and non-profit or research organizations, and for for-profit organizations with 200 or fewer employees or contractors in total. A for-profit organization above that size needs a paid plan. Read the current text at anaconda.com/legal before you install on a company server; the installer asks you to accept it.

If those terms do not suit you, skip to the section on Miniforge below.

Step 1: Download the installer

Installers are published at https://repo.anaconda.com/archive/. The file name contains the release, so open that page first and note the newest Anaconda3-…-Linux-x86_64.sh entry. At the time of writing, Anaconda's Linux instructions use release 2026.07-1:

cd ~
curl -O https://repo.anaconda.com/archive/Anaconda3-2026.07-1-Linux-x86_64.sh

On an ARM64 server, download the aarch64 build instead:

cd ~
curl -O https://repo.anaconda.com/archive/Anaconda3-2026.07-1-Linux-aarch64.sh

Step 2: Verify the download

Compute the SHA-256 hash of the file:

sha256sum ~/Anaconda3-2026.07-1-Linux-x86_64.sh

Compare the output with the hash listed next to the same file name on https://repo.anaconda.com/archive/. If the two differ, delete the file and download it again.

Step 3: Run the installer

bash ~/Anaconda3-2026.07-1-Linux-x86_64.sh

The installer is interactive:

  1. Press Enter to display the terms, scroll to the end and type yes to accept them.
  2. Press Enter to accept the default location, /home/deploy/anaconda3, or type another path.
  3. When asked whether to initialize conda, type yes. This adds a block to your ~/.bashrc so that conda is available in every new shell.

Copying the packages takes a few minutes. When it finishes, reload your shell configuration:

source ~/.bashrc

Your prompt now starts with (base), which means the default conda environment is active.

Step 4: Verify the installation

conda --version
conda list
python --version

conda list prints every package in the base environment, and python now resolves to the interpreter inside ~/anaconda3 rather than Ubuntu's system Python. The system Python under /usr/bin/python3 is untouched, and tools that depend on it keep working.

If you would rather not have the base environment activated in every shell, turn that off:

conda config --set auto_activate_base false

Anaconda Navigator, the graphical launcher included in the distribution, needs a desktop session. On a headless server you only use the conda command.

Step 5: Create and use environments

Keep the base environment as it is and give each project its own environment. That way projects can use different Python and package versions without affecting each other.

Create an environment with a specific Python version and a couple of packages:

conda create --name my_env python=3.12 numpy pandas

The first time conda contacts Anaconda's default channels it may ask you to accept the channel Terms of Service; recent installers include a plugin, conda-anaconda-tos, that handles this prompt.

Activate the environment and check which interpreter it uses:

conda activate my_env
python --version

Install more packages into the active environment:

conda install scikit-learn

Leave the environment:

conda deactivate

List all environments, and remove one you no longer need:

conda info --envs
conda remove --name my_env --all

To reproduce an environment on another machine, export it to a file and create it from that file there:

conda env export --name my_env > my_env.yaml
conda env create --file my_env.yaml

Older tutorials use source activate and source deactivate. Those forms are obsolete; use conda activate and conda deactivate.

Updating

Update conda itself, then the packages of the active environment:

conda update conda
conda update --all

Run the second command inside each environment you want to bring up to date.

Miniconda and Miniforge: lighter alternatives

Miniconda is Anaconda's minimal installer: conda, Python and their dependencies, with no extra packages and no Navigator. It suits servers, containers and CI jobs where you install only what a project needs. It is published by Anaconda and falls under the same Terms of Service. Install it the same way:

cd ~
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ~/Miniconda3-latest-Linux-x86_64.sh

Miniforge is the installer maintained by the conda-forge community. It includes conda and mamba and installs packages from the community-run conda-forge channel:

cd ~
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash Miniforge3-Linux-x86_64.sh

The environment commands from step 5 work unchanged with both.

Uninstalling Anaconda

Export any environments you want to keep (see step 5), then deactivate conda and run the uninstall script that installers from release 2025.06 onward place in the install directory:

conda deactivate
~/anaconda3/uninstall.sh

For older installations without that script, follow the manual procedure in Anaconda's uninstall documentation.

Troubleshooting

  • conda: command not found: open a new terminal or run source ~/.bashrc. If you answered no to the initialization question, run ~/anaconda3/bin/conda init and reopen the shell.
  • The installer says the directory already exists: an earlier installation is in the way. Anaconda advises against installing over it with the -u or -f flags; uninstall first, then run the installer again.
  • Downloads fail behind a firewall: the server must be able to reach repo.anaconda.com and anaconda.org.

Frequently asked questions

Should I install Anaconda system-wide with sudo?

For a single user, no. A per-user install in your home directory needs no root rights and cannot interfere with Ubuntu's own Python. Shared, multi-user installations are possible but follow a different procedure, described under advanced installation in Anaconda's documentation.

Does Anaconda replace the Python that Ubuntu ships?

No. It only changes which python comes first in your own shell's PATH. System tools keep using /usr/bin/python3, and running conda deactivate in the base environment gives you the system interpreter back for that session.

Can I use pip inside a conda environment?

Yes. Activate the environment first so that pip installs into it rather than somewhere else. Install what you can with conda and use pip for packages that conda's channels do not carry.

Anaconda or Miniconda on a VPS?

On a server with limited disk space, Miniconda or Miniforge is usually the better fit: you start from under a gigabyte and add only the packages your project uses. The full distribution is convenient when you want everything available at once and have the space for it.

Share story:

Continue reading other guides on How VPS.