Skip to main content

Conda Guide: Installing Miniforge and Managing Conda Environments

Installing Miniforge

Miniforge is a community-driven distribution of Conda that provides a minimal installation with a focus on the conda-forge repository.

Installation Steps:

  1. Visit the Conda-Forge Website:

    • Go to Conda-Forge and follow the installation instructions for your platform.
  2. Download and Install Miniforge:

    • Follow the platform-specific installation steps detailed on the Conda-Forge website.
  3. Verify the Installation:

    conda --version

    This should return a version number if Conda is installed correctly.

Creating a Conda Environment

Conda environments allow you to create isolated spaces for different projects.

Create a New Environment:

This command creates a new environment named myenv with the default Python version installed:

conda create --name myenv python

To specify a particular Python version, use:

conda create --name myenv python=3.9

This ensures the environment is set up with Python 3.9 specifically.

Activate the Environment:

conda activate myenv

Once activated, all Conda operations will affect this environment.

Deactivate the Environment:

conda deactivate

This switches back to the base Conda environment.

Basic Conda Commands

Here are some commonly used Conda commands:

CommandDescription
conda search package-nameSearch for a package and list available versions
conda install package-nameInstall the latest version of a package
conda update package-nameUpdate an installed package to the latest version
conda update condaUpdate Conda itself to the latest version
conda listList all installed packages in the active environment
conda remove package-nameUninstall a specified package from the active environment
conda env remove --name myenvDelete the environment named myenv

Updating and Cleaning Conda Environments

Keeping Conda and its environments updated and clean ensures optimal performance.

Update Conda and All Packages:

conda update conda -y && conda update --all -y && conda clean --all -y

This command updates Conda itself, all installed packages, and removes unnecessary files to free up space.

Update All Packages in an Environment:

conda update --all -y && conda clean --all -y

This updates all installed packages in the currently active environment and cleans up unnecessary files.

Removing a Conda Environment

To completely remove a Conda environment, including all installed packages and dependencies, use:

conda remove -n myenv --all

This ensures the specified environment (myenv) is deleted from your system.

Additional Resources

For more information on Conda, you can visit the official Conda documentation or check out the Conda-Forge repository.