Post

Anaconda for python

Anaconda for python

Anaconda for Python

Anaconda is a powerful Python distribution that simplifies package management and deployment for data science, machine learning, and scientific computing. Conda is Anaconda’s package, environment, and dependency manager. It is cross-platform (Windows, macOS, Linux [x86/AARCH64/PPC64LE/s390x]), cross-language (supports Python, R, C/C++, Rust, Go, and more), and ensures package compatibility and environment correctness.

Anaconda vs Miniconda vs Conda

Anaconda

  • Full distribution with GUI and pre-installed packages
  • Large download (~500MB+)
  • Includes Anaconda Navigator, Jupyter, Spyder
  • Best for: Beginners, data scientists who want everything ready

Miniconda

  • Minimal installer with just Python and conda
  • Small download (~50MB)
  • Manual package installation required
  • Best for: Experienced users, servers, minimal installations

Conda

  • Package manager included in both Anaconda and Miniconda
  • Cross-platform package and environment management
  • Language agnostic (not just Python)

Installation Guide

Just need to note that, my x86-64 machine using Ubuntu 20.04 (default python version is 3.8)

Installing Miniconda on Linux

1
2
3
4
5
6
7
8
# Download the installer. the base version is 3.9 as you can see
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_25.7.0-2-Linux-x86_64.sh

# Make it executable
chmod +x Miniconda3-py39_25.7.0-2-Linux-x86_64.sh

# Run the installer and Follow the prompts
./Miniconda3-py39_25.7.0-2-Linux-x86_64.sh

Post-Installation Setup

After installation, restart your terminal or run:

1
2
3
4
5
6
# Reload shell configuration
source ~/miniconda3/bin/activate

# Verify installation
conda --version
python3 --version

Essential Conda Commands

Environment Management

Creating Environments

1
2
3
4
# Create new environment with specific Python version
conda create --name myenv python=3.9
#Or create env via file
conda env create -f environment.yml

Managing Environments

1
2
3
4
5
6
7
8
9
# List all environments
conda env list

# Activate environment
conda activate myenv

# Deactivate current environment
conda deactivate

Environment Configuration Files

Creating environment.yml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# environment.yml
name: myproject
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.9
  - numpy
  - pandas
  - matplotlib
  - jupyter
  - pip
  - pip:
    - requests
    - beautifulsoup4

Using environment.yml

1
2
3
4
5
6
7
8
# Create environment from file
conda env create -f environment.yml

# Update existing environment
conda env update -f environment.yml

# Export current environment
conda env export > environment.yml

References

This post is licensed under CC BY 4.0 by the author.