Technical News and Knowledge Base Articles along with How to Step by Step Guides for SMB and Enterprise

Introduction to Miniconda on Ubuntu 24.04

What is Miniconda?

Miniconda is a free minimal installer for conda. Conda is a package management and environment management system that allows you to quickly install, run, and update packages and their dependencies. Miniconda is a smaller, more lightweight alternative to Anaconda, which is a full distribution that includes conda, Python, and many scientific packages.

What Service Does It Provide?

Miniconda provides a lightweight, easy-to-install environment for managing Python packages and environments. It is particularly useful for data scientists and developers who need to manage multiple projects with different dependencies.

How Does It Work?

Miniconda installs the conda package manager and Python. Users can then use conda to create isolated environments with specific packages and versions. This helps to avoid conflicts between dependencies required by different projects.

Features of Miniconda

  • Lightweight Installation: Miniconda is much smaller in size compared to Anaconda.
  • Environment Management: Create and manage multiple isolated environments.
  • Package Management: Install, update, and remove packages easily.
  • Cross-Platform: Available on Windows, macOS, and Linux.

Setting Up Miniconda on Ubuntu 24.04

Step 1: Download Miniconda

Download the Miniconda installer for Linux from the official website:


Step 2: Verify the Installer (Optional)

You can verify the integrity of the installer with sha256sum:


Compare the output with the hash provided on the Miniconda website.

Step 3: Install Miniconda

Run the installer:


Follow the prompts to complete the installation. You can accept the default options. To make the conda command available in your terminal, you need to initialize conda:

source ~/.bashrc

Step 4: Update Conda

After installation, it’s a good practice to update conda:

conda update conda

Managing Conda Environments

Creating a Conda Environment

To create a new conda environment:

conda create --name myenv python=3.11

Replace myenv with your desired environment name and 3.11 with the desired Python version.

Activating a Conda Environment

To activate the environment:

conda activate myenv

Deactivating a Conda Environment

To deactivate the environment:

conda deactivate

Listing Conda Environments

To list all conda environments:

conda env list

Removing a Conda Environment

To remove an environment:

conda remove --name myenv --all

Additional Features and Configuration

Installing Packages

To install a package into the current environment:

conda install numpy

To install a package into a specific environment:

conda install --name myenv numpy

Creating an Environment from a YAML File

You can create an environment from a YAML file that specifies the dependencies:

name: myenv
  - python=3.11
  - numpy
  - pandas

Create the environment:

conda env create -f environment.yml

Exporting an Environment to a YAML File

To export the environment:

conda env export --name myenv > environment.yml

Cloning an Environment

To clone an environment:

conda create --name newenv --clone myenv

Managing Configuration

Conda configuration can be managed using the conda config command. For example, to add a new channel:

conda config --add channels conda-forge

Permissions and Environment Variables

  • Ensure you have the necessary permissions to install packages and create environments.
  • Environment variables such as CONDA_PREFIX and CONDA_DEFAULT_ENV can be useful for scripting.

Tips and Tricks

  • Use mamba for Faster Package Management: Mamba is a reimplementation of the conda package manager in C++ for faster operation.
  conda install mamba -n base -c conda-forge
  • Use Virtual Environments for Isolation: Use virtual environments to avoid conflicts between different projects.
  • Keep Environments Lightweight: Only install the necessary packages to keep environments lightweight and efficient.
  • Backup Your Environments: Regularly export your environments to YAML files as a backup.

Additional Considerations

  • Disk Space: Keep an eye on disk space as multiple environments can consume significant storage.
  • Environment Size: Minimize the number of installed packages to keep environment sizes manageable.
  • Dependencies: Be aware of package dependencies and conflicts.