Skip to main content

What are Channels?

A channel is a URL location where conda looks for packages. Channels contain package files and associated metadata that tell conda how to install packages.
Think of channels as package repositories. Different channels can contain different versions of packages or entirely different packages.

Channel Architecture

Channels in conda follow a specific structure:
# Channel structure:
# scheme <> auth <> location <> token <> channel <> subchannel <> platform <> package_filename

class Channel:
    scheme: str           # https, http, file
    auth: str            # Authentication credentials  
    location: str        # Base URL/path
    token: str           # Access token
    name: str            # Channel name
    platform: str        # Subdirectory (linux-64, osx-64, etc)
    package_filename: str # Specific package file

Default Channels

Conda uses different default channels based on your operating system:
DEFAULT_CHANNELS_UNIX = (
    "https://repo.anaconda.com/pkgs/main",
    "https://repo.anaconda.com/pkgs/r",
)
DEFAULTS_CHANNEL_NAME = "defaults"
DEFAULT_CHANNEL_ALIAS = "https://conda.anaconda.org"
UNKNOWN_CHANNEL = "<unknown>"
The “defaults” channel is a special name that expands to the platform-specific default channels above.

Custom Channels

You can use custom channels for packages from other sources:
DEFAULT_CUSTOM_CHANNELS = {
    "pkgs/pro": "https://repo.anaconda.com",
}

conda-forge

Community-led collection of packages
conda install -c conda-forge package_name

bioconda

Bioinformatics packages
conda install -c bioconda package_name

pytorch

PyTorch and related packages
conda install -c pytorch pytorch

nvidia

NVIDIA GPU packages
conda install -c nvidia cuda-toolkit

Adding and Removing Channels

Add Channels

# Add channel to end of list (lowest priority)
conda config --add channels conda-forge

# Add to beginning of list (highest priority)
conda config --prepend channels conda-forge

# Add with specific priority
conda config --append channels conda-forge

Remove Channels

# Remove specific channel
conda config --remove channels conda-forge

# Remove all custom channels (reset to defaults)
conda config --remove-key channels

Temporary Channel Override

Use channels for a single command without modifying config:
# Install from specific channel
conda install -c conda-forge numpy

# Use multiple channels (order matters)
conda install -c pytorch -c conda-forge package_name

# Override all configured channels
conda install --override-channels -c conda-forge numpy
Using -c for one-off installations is often better than permanently adding channels.

Channel Priority

Channel priority determines which version of a package to install when multiple channels have it.

Priority Modes

class ChannelPriority(ValueEnum):
    STRICT = "strict"        # Install only from highest-priority channel
    FLEXIBLE = "flexible"    # Consider all channels, prefer higher priority
    DISABLED = "disabled"    # Ignore channel priority
# Enable strict channel priority
conda config --set channel_priority strict
Strict mode ensures packages come from the highest-priority channel that has them, regardless of version. This prevents mixing packages from multiple channels and reduces conflicts.
Behavior:
  • If channel 1 has package A version 1.0 and channel 2 has version 2.0
  • Strict mode installs version 1.0 from channel 1
  • More predictable and stable

Flexible Priority

# Enable flexible channel priority
conda config --set channel_priority flexible
Behavior:
  • Considers package versions across all channels
  • Prefers higher-priority channels when versions are equal
  • May mix packages from different channels

Disabled Priority

# Disable channel priority
conda config --set channel_priority disabled
Behavior:
  • Only considers package version and build number
  • Channel order doesn’t matter
  • Can lead to inconsistent environments
Disabling channel priority is not recommended for production environments as it can lead to difficult-to-reproduce issues.

Channel URLs and Formats

URL Schemes

Conda supports multiple URL schemes:
RECOGNIZED_URL_SCHEMES = (
    "http",
    "https",
    "ftp",
    "s3",
    "file",
)

Channel URL Examples

# Standard HTTPS URL
https://conda.anaconda.org/conda-forge

Platform Subdirectories

Channels contain subdirectories for each platform:
KNOWN_SUBDIRS = (
    "noarch",              # Platform-independent
    "emscripten-wasm32",
    "wasi-wasm32",
    "freebsd-64",
    "linux-32",
    "linux-64",
    "linux-aarch64",
    "linux-armv6l",
    "linux-armv7l",
    "linux-ppc64",
    "linux-ppc64le",
    "linux-riscv64",
    "linux-s390x",
    "osx-64",
    "osx-arm64",
    "win-32",
    "win-64",
    "win-arm64",
    "zos-z",
)
The noarch subdirectory contains platform-independent packages (pure Python, documentation, etc.).

Working with Channels

Channel Objects

Create and manipulate channel objects programmatically:
from conda.models.channel import Channel

# Create from URL
channel = Channel.from_url("https://conda.anaconda.org/conda-forge")

# Access properties
print(channel.name)          # "conda-forge"
print(channel.scheme)        # "https"
print(channel.location)      # "conda.anaconda.org"
print(channel.canonical_name) # "conda-forge"

MultiChannel

Some channel names expand to multiple channels:
from conda.models.channel import MultiChannel

# "defaults" expands to multiple channels
defaults = Channel.from_value("defaults")
print(defaults.channels)
# Returns tuple of Channel objects for:
# - https://repo.anaconda.com/pkgs/main
# - https://repo.anaconda.com/pkgs/r
# - https://repo.anaconda.com/pkgs/msys2 (Windows only)

Channel Configuration

Per-Environment Channels

Specify channels in environment files:
name: myproject
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.11
  - numpy
  - pandas

Global Channel Configuration

Edit ~/.condarc to set default channels:
channels:
  - conda-forge
  - defaults

channel_priority: strict

channel_alias: https://conda.anaconda.org

default_channels:
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r

Channel-Specific Settings

channels:
  - conda-forge
  - defaults

custom_channels:
  my-channel: https://example.com/conda

custom_multichannels:
  my-stack:
    - https://example.com/channel1
    - https://example.com/channel2

migrated_channel_aliases:
  - https://old-server.com/conda

Channel Priority in Practice

Prioritize Channels

Channel priority is determined by order in configuration:
# View current order (first = highest priority)
conda config --show channels

# Add to top (highest priority)
conda config --prepend channels conda-forge

# Result:
channels:
  - conda-forge    # Priority 1 (highest)
  - defaults       # Priority 2

Priority Values

MAX_CHANNEL_PRIORITY = 10000
# Reserved for packages that need highest priority

Example Priority Mapping

from conda.models.channel import prioritize_channels

# Create priority mapping
channels = ["conda-forge", "defaults"]
priorities = prioritize_channels(channels)

# Returns:
# {
#   'https://conda.anaconda.org/conda-forge/linux-64': ('conda-forge', 0),
#   'https://conda.anaconda.org/conda-forge/noarch': ('conda-forge', 0),
#   'https://repo.anaconda.com/pkgs/main/linux-64': ('defaults', 1),
#   'https://repo.anaconda.com/pkgs/main/noarch': ('defaults', 1),
#   'https://repo.anaconda.com/pkgs/r/linux-64': ('defaults', 2),
#   'https://repo.anaconda.com/pkgs/r/noarch': ('defaults', 2),
# }
Lower priority numbers mean higher priority. Priority 0 is the highest.

Repodata

Each channel provides metadata about available packages:
REPODATA_FN = "repodata.json"
Conda downloads repodata.json from each channel to determine available packages:
https://conda.anaconda.org/conda-forge/linux-64/repodata.json
https://conda.anaconda.org/conda-forge/noarch/repodata.json

Repodata Contents

The repodata.json file contains:
  • List of all packages in the channel/subdir
  • Package metadata (version, dependencies, build info)
  • Checksums for verification

Local Channels

Create a Local Channel

# Create channel directory structure
mkdir -p ~/my-channel/linux-64
mkdir -p ~/my-channel/noarch

# Copy packages
cp my-package-1.0-py311.tar.bz2 ~/my-channel/linux-64/

# Index the channel
conda index ~/my-channel

Use Local Channel

# Install from local channel
conda install -c file:///home/user/my-channel my-package

# Or use relative path
conda install -c ./my-channel my-package

# Add to channel list
conda config --add channels file:///home/user/my-channel
Local channels are useful for offline installations or distributing internal packages.

Mirrors and Proxies

Mirror Configuration

Use channel mirrors for faster access:
~/.condarc
channels:
  - https://mirror.example.com/conda-forge
  - defaults

# Map old URLs to new mirrors
migrated_channel_aliases:
  - https://conda.anaconda.org

migrated_custom_channels:
  conda-forge: https://mirror.example.com/conda-forge

Proxy Settings

# Set proxy for conda
conda config --set proxy_servers.http http://proxy.example.com:8080
conda config --set proxy_servers.https https://proxy.example.com:8080

# Or use environment variables
export HTTP_PROXY=http://proxy.example.com:8080
export HTTPS_PROXY=https://proxy.example.com:8080

Best Practices

Enable strict priority to ensure reproducible environments:
conda config --set channel_priority strict
This prevents mixing packages from different channels.
Use only necessary channels to reduce solve time:
# Good: focused channel list
channels:
  - conda-forge
  - defaults

# Avoid: too many channels
channels:
  - conda-forge
  - bioconda
  - pytorch
  - nvidia
  - defaults
Include channels in environment files:
name: myproject
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.11
Pin packages to specific channels when needed:
# In environment.yml
dependencies:
  - conda-forge::numpy
  - defaults::python

Troubleshooting

Check if the package exists and which channel has it:
# Search all configured channels
conda search package_name

# Search specific channel
conda search -c conda-forge package_name

# Search with wildcards
conda search "*package*"
Verify channel URLs are accessible:
# Test channel connectivity
conda config --show channels

# Try accessing channel URL
curl -I https://conda.anaconda.org/conda-forge/linux-64/repodata.json

# Check for proxy issues
conda config --show proxy_servers
Reduce the number of channels:
# Temporarily override channels
conda install --override-channels -c conda-forge package_name

# Or reduce permanent channel list
conda config --show channels
conda config --remove channels unnecessary-channel
Enable strict channel priority:
conda config --set channel_priority strict

# Rebuild environment cleanly
conda create -n clean_env --file environment.yml

Advanced Topics

Channel Tokens

For private channels requiring authentication:
# Set token in URL
conda install -c https://conda.anaconda.org/t/YOUR-TOKEN/private-channel package

# Or configure token globally
conda config --set channel_alias https://conda.anaconda.org/t/YOUR-TOKEN
Never commit tokens to version control. Use environment variables or secure credential storage.

Notices from Channels

Channels can provide notices about updates or issues:
NOTICES_FN = "notices.json"
NOTICES_CACHE_FN = "notices.cache"
NOTICES_CACHE_SUBDIR = "notices"
NOTICES_DECORATOR_DISPLAY_INTERVAL = 86400  # 24 hours in seconds

Offline Mode

Work with cached packages when offline:
# Enable offline mode
conda config --set offline True

# Or use flag
conda install --offline package_name
In offline mode, conda only uses cached packages and does not access channels.

Next Steps

Package Management

Learn how to install packages from channels

Environment Management

Create and manage conda environments

Build docs developers (and LLMs) love