Save 10%Pay yearly on any plan. 6% half-yearly, 3% quarterly. Help centreWhatsAppTelegram TeamsOpen a ticket

How to Install Anaconda on Ubuntu Linux in 5 Steps

Install Anaconda on Ubuntu: download the installer, verify it, run it, set up the shell, and create a first environment. With Miniconda as the lighter choice.

3 min readBy Smita

Reviewed by the AmazingRDP technical team

Installing Anaconda on Ubuntu Linux

Long-running notebooks and jobs belong on a server. A Linux VPS gives you root access. See Linux VPS from $6.99

Anaconda is a distribution of Python (and R) for data science. It brings its own Python, the package manager conda, and several hundred scientific packages already built, so that NumPy, pandas and Jupyter work without compiling anything. It installs into your home folder and leaves the system's own Python alone.

Anaconda or Miniconda?

AnacondaMiniconda
ContainsPython, conda and a large collection of packagesPython and conda only
Disk spaceSeveral gigabytesA few hundred megabytes
Best forA desktop where you want everything readyServers, and anyone who installs only what a project needs

The steps below are the same for both; only the installer's file name differs. A note on licensing: Anaconda's terms require a paid licence for use inside larger organisations. Read the current terms on its website if you install it for work. The community installer Miniforge works the same way and uses only the community package channel.

Step 1: download the installer

On anaconda.com, open the download page, choose Linux, and copy the link of the 64-bit installer (a file ending in .sh).

cd /tmp
wget PASTE-THE-LINK-HERE

On a desktop you can simply download it with the browser.

Step 2: verify it

sha256sum Anaconda3-*.sh

Compare the long number with the one published for that file on Anaconda's site. If they differ, the download is damaged or not genuine; do not run it.

Step 3: run the installer

bash Anaconda3-*.sh
  1. Press Enter to read the licence, and type yes to accept it.
  2. Accept the suggested location in your home folder.
  3. When asked whether to initialise conda for your shell, answer yes.

Do not run the installer with sudo. It belongs to your user.

Step 4: activate and check

source ~/.bashrc
conda --version
conda list | head

The prompt now starts with (base), the name of the default environment. If you would sooner not have it active in every terminal:

conda config --set auto_activate_base false

Step 5: create an environment for your project

Do not install project packages into base. Give each project its own environment, with its own Python version and packages, so that projects cannot break each other.

conda create -n analysis python=3.12 pandas jupyterlab
conda activate analysis
python --version
conda deactivate
CommandDoes
conda env listLists your environments
conda install NAMEAdds a package to the active environment
conda update --allUpdates the active environment
conda env export > environment.ymlWrites down the environment so that others can recreate it
conda env create -f environment.ymlRecreates it elsewhere
conda env remove -n analysisRemoves an environment

conda and pip together

Inside an environment, install with conda first and use pip only for packages conda does not have. Mixing them freely in the same environment is the usual cause of broken installations. See also upgrading pip on Ubuntu for the system Python.

Jupyter on a remote server

On a server without a screen, start Jupyter without a browser and reach it through an SSH tunnel:

jupyter lab --no-browser --port 8888

On your own computer:

ssh -L 8888:localhost:8888 user@203.0.113.10

Then open the address with the token that Jupyter printed, replacing the host with localhost. Do not open port 8888 in the firewall: a notebook server is a way to run any command on the machine.

Update and remove

conda update conda
conda update anaconda

To take Anaconda off the machine, erase its folder in your home directory (anaconda3) and the block of lines between # >>> conda initialize and # <<< conda initialize in ~/.bashrc.

Problems

SignCause
conda: command not foundThe shell was not initialised. Run ~/anaconda3/bin/conda init and open a new terminal
"Solving environment" takes very longToo many packages in one environment, often base. Create a fresh, smaller one
Disk fills upconda clean --all clears downloaded package files
System tools behave oddlybase is active and its Python shadows the system's. Switch auto-activation off (step 4)
Killed during installationToo little memory; a small server needs 2 GB or Miniconda

For computations that run for hours, a server spares your laptop: see our Linux VPS plans. Editing notebooks and code on that server from your own machine is described in VS Code on Ubuntu.

Questions

How do I install Anaconda on Ubuntu?

Download the Linux installer from anaconda.com, run it with bash, accept the licence and let it initialise your shell.

What is the difference between Anaconda and Miniconda?

Anaconda includes a large collection of packages. Miniconda contains only Python and conda, and you install what you need.

Should I install Anaconda with sudo?

No. Install it as your own user into your home folder.

How do I create a conda environment?

Run conda create -n NAME python=3.12 and then conda activate NAME.