Anik Das

May 09, 2025 • 1 min read

Miniconda installation and use for virtual env

Miniconda provides a lightweight way to install conda on resource-limited Linux systems and lets you create isolated Python environments to manage packages efficiently. The following steps walk you through downloading, installing, initializing Miniconda, and creating virtual environments.

Download the Miniconda Installer

Download the official Miniconda installer script for Linux and place it in a dedicated directory:

  • Create a directory to hold the installer:

    mkdir -p ~/miniconda3 
  • Fetch the latest 64-bit Linux installer using wget:

    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \   -O ~/miniconda3/miniconda.sh

    Run the Installer in Silent Mode

Install Miniconda without interactive prompts and clean up the installer script:

  • Execute the installer with batch options (-b for silent, -p to specify the install path):

    bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 
  • Remove the installer script after installation:

    rm -rf ~/miniconda3/miniconda.sh 

Initialize Conda for Your Shell

Set up your shell environment so that conda commands become available:

  • Initialize for Bash (or replace bash with zsh if you use Zsh):

    ~/miniconda3/bin/conda init bash 
  • Restart your terminal or reload your shell configuration:

    exec $SHELL 
  • Verify the installation:

    conda --version 

    You should see output similar to conda 24.x.x confirming a successful install.3

Create and Manage Virtual Environments

Use conda to isolate projects and their dependencies:

  • Create a new environment named myenv with Python 3.9:

    conda create --name myenv python=3.9 
  • Activate the environment:

    conda activate myenv 
  • Install additional packages inside myenv, for example:

    conda install numpy pandas 
  • List all environments on your system:

    conda env list 
  • Deactivate the current environment:

    conda deactivate 

Join Anik on Peerlist!

Join amazing folks like Anik and thousands of other people in tech.

Create Profile

Join with Anik’s personal invite link.

0

0

1