Cantech Knowledge Base

Your Go-To Hosting Resource

How to Install Miniconda on Ubuntu 22.04?

Miniconda is a very lightweight distribution of Conda, which is a package and environment management system for Python. It is very easy to use and deploy dash virtual environments to and fro, and hence, it has become the choice for developers and data scientists. Miniconda lacks non-essential libraries like Anaconda; thus, it is a smaller and more efficient distribution.

In this guide, we will discuss how to install Miniconda on Ubuntu 22.04. It will cover the step-by-step procedures, and normal and silent installation methods will also be discussed, along with how to recognize a successful installation and how to uninstall Miniconda.

Why Install Miniconda on Ubuntu 22.04?

Installing Miniconda on Ubuntu 22.04 gives you some added benefits:

  • Thin Alternative to Anaconda: Miniconda installs just Conda and essential dependencies, easing its footprint on disk.
  • Better Package Management: Conda makes it easy to install and manage Python packages and dependencies.
  • Isolated Environments: This allows users to create different environments of different projects.
  • Install Anaconda Packages when Needed: One can install any Anaconda package when necessary.

Complete Guide to Install Miniconda on Ubuntu 22.04

There are a few basic steps that need to be followed while installing Miniconda on Ubuntu 22.04!

Step 1: Upgrade the System
Before installing Miniconda, make sure your system packages are up-to-date.

sudo apt update && sudo apt upgrade -y

Step 2: Download the Miniconda Installer
Navigate to the official Miniconda download page or issue the command below for a direct download of the latest version.

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh

Step 3: Verify the Installer (Optional, But Highly Recommended)
In order to verify that the downloaded file has not been corrupted, check its SHA256 checksum:

sha256sum Miniconda3-latest-Linux-x86_64.sh

Match the output against the official checksum from the Miniconda website.

Step 4: Run the Miniconda Installer
Normal Installation
To specify the installation, call the installer script:

bash Miniconda3-latest-Linux-x86_64.sh

Follow the on-screen prompts:

  • Press enter to proceed.
  • Scroll down the lengthy license statement and enter yes to accept.
  • Select your installation location (default: ~/miniconda3).

Silent Installation (Automated)
To perform a user-input-free Miniconda installation, run the following command:

bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3

Installing Miniconda without user input installs it in the default location (~miniconda3).

Step 5: Enable Miniconda
Start your terminal. In the terminal, initialize Miniconda by running:

source ~/miniconda3/bin/activate

Or, you can either start a new terminal instance or activate the Conda within the terminal with:

conda init

This will make sure that Conda will be available during the next time you open the terminal.

Step 6: Verify the Installation
To verify whether Miniconda was installed successfully, use:

conda --version

This should tell you what version of Conda you have.

To run a command that will list the packages that have been installed and check whether Conda has been installed:

Step 7: Creating and Managing Environments in Conda
You can create a new Conda environment by issuing the command below. In this case, I will also add Python 3.10:

conda create --name myenv python=3.10

Activate the environment:

conda activate myenv

To deactivate:

conda deactivate

Step 8: Updating Miniconda
To bring Conda to the latest version, use the following command:

conda update conda

To update all the packages installed with Conda, issue the command:

conda update --all

Step 9: Uninstalling Miniconda
In case you would like to uninstall Miniconda completely, follow the steps below:

Step 9.1: Remove the Miniconda Directory

rm -rf ~/miniconda3

Step 9.2: Remove Conda References from Shell Configuration
Open the .bashrc and find the lines referring to Conda, and remove them:

nano ~/.bashrc

Also delete every line containing either conda or miniconda.

Save the file and thereafter run:

Step 9.3: Remove Conda from System PATH (if necessary)
Should Conda have been added to your system PATH, you might manually remove it by editing:

You can remove any references to miniconda3, and then save and reload:

source ~/.bashrc

Conclusion

Installing Miniconda on Ubuntu 22.04 would be easy, as it is an advanced environment management system for Python users. You can set up Miniconda efficiently, create virtual environments, and manage dependencies by following this guide. Miniconda is light and provides utility to every work style without the weight of the entire Anaconda.

Frequently Asked Questions

What is the difference between Miniconda and Anaconda?
Miniconda is a small installer of Conda, containing only the essential components, while Anaconda is large as it comes with too many other packages.

How do I uninstall Miniconda from Ubuntu 22.04?
Remove Miniconda using:

rm -rf ~/miniconda3

Also remove those references from .bashrc of Conda and restart the terminal.

Can I install Miniconda alongside Anaconda?
There is no problem doing so, although probably not recommended because of possible conflicts. However, if it is required, they have to be installed in different directories.

How do I update Miniconda?
To update Miniconda, run the following command:

conda update conda

It will update Conda to the latest version.

How do I create a new Conda environment with specific Python and packages?
To create a new Conda environment with specific Python and packages, run the following command:

conda create --name myenv python=3.9 numpy pandas

Here, you have to replace myenv with your own selected name for the environment and specify the needed packages.

April 2, 2025