C.W.K.
Stream
Lesson 04 of 05 · published

Channels, Binaries, Solver, Mixing with pip

~12 min · conda, concepts, internals

Level 0Newbie
0 XP0/55 lessons0/16 achievements
0/80 XP to next level80 XP to go0% complete

Four conda concepts repeatedly matter in real use.

Channels. Channels are package repositories. The defaults channel (Anaconda Inc) is the original; it has fewer packages than conda-forge and stricter commercial licensing. conda-forge is the community channel with 30,000+ packages and the most active maintainers. bioconda is for bioinformatics tools. pytorch, nvidia, etc. are vendor channels for specific stacks. Use -c conda-forge on most installs unless you have a reason not to.

Binary packages. conda's killer feature. A conda package can include compiled C/C++ libraries, CUDA runtimes, R packages, even Java. When you install pytorch, conda fetches a pre-compiled binary matched to your OS, CPU architecture, and CUDA version — no compilation. This is what makes conda the default for ML / data science.

The solver. conda used to use a Python-based SAT solver that was famously slow (multiple minutes for complex envs). The new libmamba solver (default since conda 23.10) is dramatically faster — 5-10x for typical envs. If you're on an older conda, run conda install -n base conda-libmamba-solver and conda config --set solver libmamba to enable it.

Mixing conda + pip. Some packages are PyPI-only (not on any conda channel). The right pattern: install all conda packages first, THEN pip install the rest. Reverse order can corrupt the env. Document the pip layer in environment.yml under a pip: section so it's reproducible.

Code

Mixing conda + pip cleanly·yaml
# environment.yml — conda first, pip second
name: my-env
channels:
  - conda-forge
  - pytorch
dependencies:
  # Conda layer — install FIRST
  - python=3.12
  - pytorch
  - pandas
  - jupyterlab
  # Pip layer — install AFTER
  - pip
  - pip:
    - some-pypi-only-package
    - another-pypi-only-package

# 'conda env create -f environment.yml' installs conda first, pip second.
# Reverse order will sometimes corrupt the env.
Verify libmamba solver is on·bash
# Check current solver
conda config --show solver
# solver: libmamba    ← this is what you want

# If 'classic', upgrade:
conda install -n base conda-libmamba-solver
conda config --set solver libmamba

External links

Exercise

Run 'conda config --show solver'. If it says 'classic', enable libmamba (the snippet above). Then create a fresh env with a heavy package list ('conda create -n speed-test python=3.12 numpy pandas matplotlib jupyterlab pytest scipy') and time it. The solver speed-up is enough to change how often you create envs.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.