Conda handles a lot of Python pain points on Ubuntu, including isolated dependencies, version switching, and keeping the system Python untouched. This guide walks through how to install Conda on Ubuntu, from system prep to running your first environment. Commands work on Ubuntu 22.04 and 24.04.
Before You Install Conda on Ubuntu
Refresh the package index first:
sudo apt-get update
This pulls the latest metadata so the install pulls clean dependencies. If apt throws errors here, this apt-get troubleshooting guide covers the usual fixes.
The installer downloads through curl. Check if it’s already on your machine:
curl --version
If the response is blank or errors out, add it:
sudo apt-get install curl
Some Ubuntu builds still throw a missing binary error after install. This walkthrough on fixing the curl: command not found error sorts that out quickly.
Download the Anaconda Installer
The full Anaconda build comes with hundreds of pre-installed data science libraries. If disk space is tight or you only need the core, the Miniconda install path gives you just the package manager.
Grab the latest Linux build directly into /tmp:
cd /tmp
curl -O https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh
Using /tmp keeps your home directory uncluttered. The -O flag tells curl to save the file under its original name. You can grab the newest version straight from the Anaconda downloads page.
Run the Conda Install Script on Ubuntu
Once the download finishes, launch the installer:
bash Anaconda3-2020.11-Linux-x86_64.sh
By default, the script writes to /home/<username>/anaconda3. Swap in your actual login name. Accept the license terms when asked, and let the installer add its init block to .bashrc when prompted.
Reload the shell once the install finishes:
source ~/.bashrc
Check the version:
conda -V
Expected output: conda 4.9.2 (or newer, depending on the build).
If your prompt doesn’t pick up conda after reload, the PATH likely wasn’t written. This guide on setting Linux environment variables shows where to add the export line manually.
Keep Conda and Anaconda Updated
Run these every few weeks to stay current:
conda update conda
conda update anaconda
The first updates the package manager itself. The second pulls the latest Anaconda distribution with all bundled libraries.
Create and Manage Conda Environments on Ubuntu
With the install Conda Ubuntu setup wrapped up, isolated environments let each project keep its own dependencies. No more global pip conflicts.
Create one named My_env1 running Python 3:
conda create --name My_env1 python=3
Activate it:
conda activate My_env1
The prompt prefix changes to (My_env1), so you always know which environment you’re inside. Step out when done:
conda deactivate
Installing Packages in an Active Environment
With the environment active:
conda install <package-name>[=version]
Replace <package-name> with whatever library you need. Drop the [=version] suffix to get the latest compatible build, or pin a specific release the same way you’d lock an apt package version.
If you’re new to working with the shell, this Linux command line guide covers the basics you’ll keep using.
FAQs
Do I need Anaconda or just Miniconda?
Miniconda ships with Python, conda, and a handful of core packages under 100 MB. Anaconda bundles 250+ data science libraries by default. Pick Miniconda for lightweight setups; pick Anaconda if you want everything ready out of the box.
How do I uninstall Conda from Ubuntu?
Run rm -rf ~/anaconda3, then open ~/.bashrc and remove the conda initialize block. Reload with source ~/.bashrc. The (base) prefix should disappear from your terminal prompt.
Why does conda: command not found show up after install?
The shell hasn’t loaded the new PATH yet. Run source ~/.bashrc, or close and reopen your terminal. If it still fails, the installer skipped the .bashrc step. Re-run the script with the -u flag to update the existing install.
Can I run conda alongside the system Python on Ubuntu?
Yes. Conda environments stay isolated from /usr/bin/python. The base environment loads when a shell opens, but disable that with conda config –set auto_activate_base false if you’d rather keep your default prompt clean.
Where does Conda install packages by default?
Inside the active environment folder, usually ~/anaconda3/envs/<env-name>/. The base environment writes to ~/anaconda3/ itself. Each environment keeps its own site-packages directory, so libraries don’t bleed across projects.