Comprehensive reference for conda, conda-build, and package management workflows.
- Installation
- Conda Basics
- Configuration (.condarc)
- Environments
- Python Management
- Package Management
- Package Inspection & Debugging
- Dependency Analysis
- conda-build
- conda-build Debugging
- Recipe Development
- Cross-Platform Packaging
- Binary Inspection (Per-Platform)
- Patching
- conda skeleton
- conda convert
- Anaconda Cloud
- Solver & Channel Management
- Cleanup & Maintenance
- Security & Auditing
- Useful One-Liners
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/minicondacurl -fsSL https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh -o ~/miniconda.sh
bash ~/miniconda.sh -b -p $HOME/minicondacurl -fsSL https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh -o ~/miniforge.sh
bash ~/miniforge.sh -b -p $HOME/miniforge%%bash
MINICONDA_INSTALLER_SCRIPT=Miniconda3-latest-Linux-x86_64.sh
MINICONDA_PREFIX=/usr/local
wget https://repo.continuum.io/miniconda/$MINICONDA_INSTALLER_SCRIPT
chmod +x $MINICONDA_INSTALLER_SCRIPT
./$MINICONDA_INSTALLER_SCRIPT -b -f -p $MINICONDA_PREFIX
conda install --channel defaults conda python=3.9 --yes
conda update --channel defaults --all --yesconda --version # Check conda version
conda info # Full conda installation info
conda info --json # Machine-readable info (useful for scripts)
conda update conda # Update conda itself
conda update anaconda # Update anaconda metapackage
conda update --all # Update all packages in active environment
conda update --all -y # Same, non-interactiveconda config --show # Show all config values (resolved)
conda config --show-sources # Show config values with source file paths
conda config --get # Get all keys/values from .condarc
conda config --get channels # Get just channels
conda config --show channels # Show active channels (ordered)conda config --add channels conda-forge # Prepend channel (highest priority)
conda config --append channels conda-forge # Append channel (lowest priority)
conda config --add channels defaults
conda config --add channels bioconda
conda config --remove channels conda-forge # Remove a channel
conda config --set channel_priority strict # Strict channel priority (recommended)conda config --set solver libmamba # Use libmamba solver (faster)
conda config --set solver classic # Revert to classic solverconda config --set auto_activate_base false # Don't auto-activate base
conda config --set anaconda_upload yes # Auto-upload after build
conda config --set anaconda_upload no # Disable auto-upload
conda config --set show_channel_urls true # Show channel URLs in conda list
conda config --set always_yes true # Skip confirmation prompts# Place a .condarc inside environment prefix to override per-env
# e.g., ~/miniconda/envs/myenv/.condarcconda info --envs # List all envs, active marked with *
conda info -e # Short alias
conda env list # Same thing
echo $CONDA_PREFIX # Show active env prefix path
echo $CONDA_DEFAULT_ENV # Show active env nameconda create -n myenv # Empty env
conda create -n myenv python=3.12 # With specific Python
conda create -n myenv python=3.12 numpy pandas # With packages
conda create -n myenv --clone source_env # Clone existing env
conda create -p /path/to/env python=3.12 # At specific path (prefix)conda activate myenv # Activate
conda deactivate # Deactivate (return to base)
conda activate # Activate base# Full export (platform-specific, pinned versions)
conda env export > environment.yml
conda env export --no-builds > environment.yml # Without build strings
# Cross-platform export (only explicitly requested packages)
conda env export --from-history > environment.yml
# Package list (plain text, for conda create --file)
conda list --export > spec-list.txt
# Explicit spec list (exact URLs, fully reproducible, single-platform)
conda list --explicit > explicit-spec.txt
conda create -n clone_env --file explicit-spec.txt
# Recreate from yml
conda env create -f environment.yml
conda env create -f environment.yml -n custom_name # Override env name
# Update existing env from yml
conda env update -n myenv --file environment.yml
conda env update -n myenv --file environment.yml --prune # Remove unlisted pkgsconda remove -n myenv --all # Remove entire environment
conda env remove -n myenv # Same thing# Dry run: see what would be installed without installing
conda create -n test_env python=3.12 numpy --dry-run
# Simulate environment on different platform
CONDA_SUBDIR=osx-arm64 conda create -n test_env python=3.12 --dry-run
CONDA_SUBDIR=linux-aarch64 conda create -n test_env python=3.12 --dry-run
CONDA_SUBDIR=win-64 conda create -n test_env python=3.12 --dry-run
# Test multiple Python versions
for py in 3.10 3.11 3.12 3.13; do
echo -e "\n===== python $py ====="
conda create --dry-run --quiet -n __test__ python=$py pandas
doneconda activate --stack secondary_env # Stack env on top of current (adds to PATH)conda search python # All available Python versions
conda search --full-name python # Exact name match only
conda search -f python # Alias
conda create -n py314 python=3.14 # Install specific version
conda install python=3.13 # Change Python in active envconda search numpy # Search default channels
conda search -c conda-forge black # Search specific channel
conda search conda-forge::black # Alternate channel syntax
conda search --override-channels -c defaults numpy # Only search defaults
conda search numpy=1.26 # Search specific version
conda search "numpy>=1.24,<1.27" # Version range
conda search numpy --info # Full metadata
conda search numpy=1.26 --info | sed '/file name/,/timestamp/d' # Quick dep checkconda install numpy # In active env
conda install -n myenv numpy # In named env
conda install numpy=1.26.4 # Exact version
conda install "numpy>=1.24,<1.27" # Version range
conda install -c conda-forge black # From specific channel
conda install scipy --channel conda-forge --channel bioconda # Multiple channels
conda install --use-local mypackage # From local build
conda install conda-build # Install conda-build
conda install m2-patch posix # Windows: MSYS2 toolsconda update numpy # Update single package
conda update --all # Update everything
conda update -n myenv --all # Update in named envconda remove numpy # From active env
conda remove -n myenv numpy # From named env
conda remove -n myenv numpy scipy pandas # Multiple packages
conda uninstall numpy # Alias for removeconda list # All packages in active env
conda list -n myenv # In named env
conda list numpy # Filter by name
conda list | grep pandas # Grep filter
conda list --show-channel-urls # Include channel source
conda list --export > packages.txt # Export for recreation
conda list --explicit > explicit.txt # Fully explicit spec
conda list --json # JSON output (for scripting)conda inspect linkages package_name # Show shared lib linkages (Linux/macOS)
conda inspect objects package_name # Show shared lib objects (macOS)
conda inspect channels -n myenv # Show channel source per package# Extract and inspect a .conda or .tar.bz2 package
conda package --pkg-name=numpy-1.26.4-py312h.tar.bz2 -w . # Extract to working dir
# Or use cph (conda-package-handling)
cph extract numpy-1.26.4-py312h*.conda --dest ./inspect_dir
# List files inside a package without extracting
conda search numpy --info # Shows file count, deps
python -c "import tarfile; t=tarfile.open('pkg.tar.bz2'); t.list()"
# Inspect metadata
cat <prefix>/conda-meta/numpy-*.json | python -m json.tool# Download and inspect channel repodata
curl -s https://repo.anaconda.com/pkgs/main/linux-64/repodata.json | python -m json.tool | head -100
curl -s https://repo.anaconda.com/pkgs/main/linux-64/repodata.json | python -c "
import json, sys
data = json.load(sys.stdin)
for pkg, info in data['packages'].items():
if 'numpy' in pkg:
print(pkg, info.get('depends', []))
" | head -20# Check what run_exports a package declares
cat <prefix>/conda-meta/numpy-*.json | python -c "
import json, sys
meta = json.load(sys.stdin)
print(meta.get('run_exports', 'none'))
"# See full dependency tree for a package
conda search numpy=1.26 --info # Direct deps listed in metadata
# Solve without installing (dry run)
conda install numpy pandas --dry-run # Shows full resolution plan
# Verbose solver output
conda install numpy -vv # Very verbose (solver trace)
conda install numpy -vvv # Maximum verbosity
# Check for conflicts
conda install numpy scipy --dry-run 2>&1 | grep -i conflict# Find what depends on a package
conda search --reverse-dependency numpy # Not always available
# Alternative: query repodata
python -c "
import json, urllib.request
url = 'https://repo.anaconda.com/pkgs/main/linux-64/repodata.json'
data = json.loads(urllib.request.urlopen(url).read())
for pkg, info in data['packages'].items():
if any('numpy' in d for d in info.get('depends', [])):
print(pkg)
" | sort -u | head -20pip install pipdeptree
pipdeptree -p numpy # Show tree for numpy
pipdeptree --reverse --packages numpy # What depends on numpyconda build . # Build from current dir
conda build recipe_dir # Build from recipe path
conda build recipe_dir --python=3.12 # Override Python version
conda build recipe_dir --numpy=1.26 # Override NumPy version
conda build recipe_dir -c conda-forge -c defaults # Specify channels
conda build recipe_dir --variant-config-file cbc.yaml # Custom build variants
conda build recipe_dir --no-test # Skip test phase
conda build recipe_dir --keep-old-work # Don't clean work dir
conda build recipe_dir --dirty # Reuse work dir (incremental)
conda build recipe_dir --debug # Drop into debug shell on failure
# Multi-output build
conda build recipe_dir --output # Show output paths without building
conda build recipe_dir --output-folder ./local-channel # Output to custom dir
# Build with specific build string / build number
conda build recipe_dir --build-number 1conda build --test package.tar.bz2 # Test existing package
conda build --test package.conda # .conda format
conda build --test /path/to/conda-bld/linux-64/pkg.tar.bz2 # Full path# conda_build_config.yaml
python:
- 3.11
- 3.12
- 3.13
numpy:
- 1.26
- 2.0
pin_run_as_build:
python:
min_pin: x.x
max_pin: x.x# Key variables available inside build.sh / bld.bat
echo $PREFIX # Target install prefix
echo $BUILD_PREFIX # Build tools prefix
echo $SRC_DIR # Extracted source directory
echo $PKG_NAME # Package name
echo $PKG_VERSION # Package version
echo $PKG_BUILDNUM # Build number
echo $RECIPE_DIR # Recipe directory
echo $SP_DIR # Python site-packages dir ($PREFIX/lib/pythonX.Y/site-packages)
echo $STDLIB_DIR # Python stdlib dir
echo $CPU_COUNT # Available CPUs for parallel build
echo $PYTHON # Path to Python interpreter
echo $PIP # Path to pip
# Cross-compilation variables
echo $CONDA_BUILD_CROSS_COMPILATION # 1 if cross-compiling
echo $BUILD # Build platform triple (e.g. x86_64-conda-linux-gnu)
echo $HOST # Host platform triple
echo $target_platform # Target platform (e.g. linux-64, osx-arm64)
# macOS specific
echo $MACOSX_DEPLOYMENT_TARGET # e.g. 11.0
echo $CONDA_BUILD_SYSROOT # Path to macOS SDK sysroot
# Windows specific
echo %LIBRARY_BIN% # Library bin dir
echo %LIBRARY_INC% # Library include dir
echo %LIBRARY_LIB% # Library lib dir
echo %LIBRARY_PREFIX% # Library prefix
echo %SCRIPTS% # Scripts dirconda build purge # Remove old build artifacts
conda build purge-all # Remove all build artifacts & caches
# Index a local channel
conda index /path/to/local-channel
# Use local build in another env
conda install --use-local mypackage
conda install -c local mypackage # Equivalentconda build recipe_dir -v # Verbose
conda build recipe_dir -vv # Very verbose (shows solver)
conda build recipe_dir -vvv # Maximum verbosity# Keep work dir on failure for inspection
conda build recipe_dir 2>&1 | tee build.log
# Enter debug shell at point of failure
conda build recipe_dir --debug
# Reuse previous work dir (skip source extraction)
conda build recipe_dir --dirty
# Skip test phase to isolate build vs test failures
conda build recipe_dir --no-test
# Then test separately
conda build --test /path/to/built-package.conda# After --debug, you're dropped into the build env:
echo $PREFIX
ls $PREFIX/lib/
ls $PREFIX/include/
cat $PREFIX/conda-meta/*.json | python -m json.tool
# Check what's in the build environment
conda list -p $BUILD_PREFIX
conda list -p $PREFIX
# Check the work directory
ls $SRC_DIR
cat $SRC_DIR/CMakeLists.txt # or setup.py, Cargo.toml, meson.build, etc.# Missing host dependency → "fatal error: xyz.h: No such file or directory"
# Fix: add the library to host requirements
# Missing run dependency → ImportError at test time
# Fix: add to run requirements
# run_exports conflict → RuntimeError (conda-build 26.1.0+)
# "package appears in its own host/run requirements"
# Fix: use ignore_run_exports in build section
# Linking error → "undefined symbol" / "cannot find -lxyz"
# Fix: ensure library is in host, check LDFLAGS / LIBRARY_PATH
# Python version mismatch → "Module compiled against ABI version X but running Y"
# Fix: rebuild against correct Python; check python pin# Show resolved recipe (after Jinja2 + selectors)
conda render recipe_dir
conda render recipe_dir --python=3.12
conda render recipe_dir --variant-config-file cbc.yaml
# Show what packages would be built (output filenames)
conda build recipe_dir --output
conda build recipe_dir --output --python=3.12package:
name: mypackage
version: "1.2.3"
source:
url: https://github.com/org/repo/archive/refs/tags/v{{ version }}.tar.gz
sha256: abc123...
patches:
- fix_build.patch
build:
number: 0
skip: true # [win]
script: python -m pip install . -vv --no-deps --no-build-isolation
# Or: script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
requirements:
build:
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- cmake
- make # [unix]
- ninja # [win]
host:
- python
- pip
- setuptools
- numpy
run:
- python
- {{ pin_compatible('numpy') }}
test:
imports:
- mypackage
requires:
- pytest
source_files:
- tests/
commands:
- pytest tests/ -v
- mypackage --version
about:
home: https://github.com/org/repo
license: MIT
license_family: MIT
license_file: LICENSE
summary: Short description
description: |
Longer description of the package.
dev_url: https://github.com/org/repo
doc_url: https://mypackage.readthedocs.io# Platform selectors
skip: true # [win]
skip: true # [osx]
skip: true # [linux]
skip: true # [unix] # linux + osx
skip: true # [osx and arm64]
skip: true # [linux and aarch64]
# Python version selectors
skip: true # [py<39]
skip: true # [py>=313]
# Combined
- package # [unix and py>=312]{% set name = "mypackage" %}
{% set version = "1.2.3" %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
url: https://pypi.org/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
sha256: ...
# Environment variable access
build:
string: {{ environ.get('GIT_DESCRIBE_TAG', 'unknown') }}
# Compiler functions
requirements:
build:
- {{ compiler('c') }} # Resolves to platform-specific compiler
- {{ compiler('cxx') }}
- {{ compiler('fortran') }}
- {{ compiler('rust') }}
- {{ stdlib('c') }} # C standard library# In requirements
- {{ pin_compatible('numpy') }} # Default: x.x
- {{ pin_compatible('numpy', min_pin='x.x', max_pin='x.x') }}
- {{ pin_compatible('numpy', max_pin='x') }} # Major version only
- {{ pin_subpackage('mylib', exact=True) }} # Exact match for subpackage
- {{ pin_subpackage('mylib', max_pin='x.x.x') }} # Flexible subpackage pin
# In conda_build_config.yaml
pin_run_as_build:
python:
min_pin: x.x
max_pin: x.xoutputs:
- name: mylib
build:
binary_relocation: false # NOTE: must be in outputs.build, NOT top-level build
requirements:
build:
- {{ compiler('c') }}
host:
- zlib
run:
- zlib
test:
commands:
- test -f $PREFIX/lib/libmy.so # [linux]
- name: mylib-python
requirements:
host:
- python
- {{ pin_subpackage('mylib', exact=True) }}
run:
- python
- {{ pin_subpackage('mylib', exact=True) }}
test:
imports:
- mylibbuild:
ignore_run_exports:
- libfoo # Ignore run_exports from libfoo (prevents self-dep loops)
ignore_run_exports_from:
- {{ compiler('c') }} # Ignore run_exports from compiler package#!/bin/bash
set -ex
# Detect platform
if [[ "${target_platform}" == osx-* ]]; then
export CFLAGS="${CFLAGS} -Wno-deprecated-declarations"
fi
if [[ "${target_platform}" == linux-* ]]; then
export LDFLAGS="${LDFLAGS} -Wl,-rpath,${PREFIX}/lib"
fi
# CMake-based
mkdir build && cd build
cmake ${CMAKE_ARGS} \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DPYTHON_EXECUTABLE=${PYTHON} \
..
make -j${CPU_COUNT}
make install
# Python pip install
${PYTHON} -m pip install . -vv --no-deps --no-build-isolation
# Rust (with maturin)
${PYTHON} -m pip install . -vv --no-deps --no-build-isolation
# Or: maturin build --release --interpreter ${PYTHON}
# PyO3 on Python 3.14+
export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
${PYTHON} -m pip install . -vv --no-deps --no-build-isolation@echo on
:: CMake-based
mkdir build
cd build
cmake -G "NMake Makefiles" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DPYTHON_EXECUTABLE=%PYTHON% ^
..
if errorlevel 1 exit 1
nmake
if errorlevel 1 exit 1
nmake install
if errorlevel 1 exit 1
:: Python pip install
%PYTHON% -m pip install . -vv --no-deps --no-build-isolation
if errorlevel 1 exit 1# meta.yaml
build:
skip: true # [not linux]
requirements:
build:
- {{ compiler('c') }}
- {{ stdlib('c') }}
- cmake
- make
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
host:
- python
- pip# Shared library dependencies
otool -L $PREFIX/lib/libfoo.dylib
otool -L $PREFIX/lib/python3.12/site-packages/foo.cpython-312-darwin.so
# Library ID and rpaths
otool -l $PREFIX/lib/libfoo.dylib | grep -A2 LC_RPATH
otool -l $PREFIX/lib/libfoo.dylib | grep -A2 LC_ID_DYLIB
# Fix install names
install_name_tool -change old_path new_path $PREFIX/lib/libfoo.dylib
install_name_tool -add_rpath @loader_path/../lib $PREFIX/lib/libfoo.dylib
install_name_tool -id @rpath/libfoo.dylib $PREFIX/lib/libfoo.dylib
# Code signing (arm64 requires it)
codesign -v --deep $PREFIX/lib/libfoo.dylib
codesign -s - --force $PREFIX/lib/libfoo.dylib # Ad-hoc sign
# Architecture check
file $PREFIX/lib/libfoo.dylib
lipo -info $PREFIX/lib/libfoo.dylib # Universal binary check
# Symbols
nm -gU $PREFIX/lib/libfoo.dylib | head -20 # Exported symbols# Shared library dependencies
ldd $PREFIX/lib/libfoo.so
ldd $PREFIX/lib/python3.12/site-packages/foo.cpython-312-x86_64-linux-gnu.so
# Detailed ELF info
readelf -d $PREFIX/lib/libfoo.so # Dynamic section (NEEDED, RPATH, RUNPATH)
readelf -h $PREFIX/lib/libfoo.so # ELF header (arch, ABI)
readelf --version-info $PREFIX/lib/libfoo.so # Symbol versioning (GLIBC_2.XX)
# RPATH / RUNPATH
readelf -d $PREFIX/lib/libfoo.so | grep -E 'RPATH|RUNPATH'
patchelf --print-rpath $PREFIX/lib/libfoo.so
patchelf --set-rpath '$ORIGIN/../lib' $PREFIX/lib/libfoo.so
# Symbols
nm -D $PREFIX/lib/libfoo.so | grep ' T ' # Exported symbols
objdump -T $PREFIX/lib/libfoo.so | head -20 # Dynamic symbol table
# glibc version
ldd --version
# File type
file $PREFIX/lib/libfoo.so:: DLL dependencies
dumpbin /dependents %LIBRARY_BIN%\foo.dll
:: Exported symbols
dumpbin /exports %LIBRARY_BIN%\foo.dll
:: All headers
dumpbin /headers %LIBRARY_BIN%\foo.dll
:: Find a DLL in PATH
where foo.dll
:: Python extension module
dumpbin /dependents %SP_DIR%\foo.pyd# From modified source (most reliable)
cd work/
cp file.py file.py.orig
# ... make changes to file.py ...
diff -u file.py.orig file.py > ${RECIPE_DIR}/fix_something.patch
# From git
cd work/
git diff > ${RECIPE_DIR}/fix_something.patch
git diff HEAD~1 -- path/to/file > ${RECIPE_DIR}/fix_something.patch
# Multifile patch
diff -ruN original_dir/ modified_dir/ > ${RECIPE_DIR}/fix_something.patchCritical checklist for successful patches:
- Exact context lines (whitespace matters!)
- Correct indentation (spaces vs tabs)
- Trailing newline at end of file
- Accurate line numbers (account for copyright headers, other patches)
- Correct path prefix (a/ and b/ for git-style, or adjust strip level)
- Platform line endings (\n for unix patches)
source:
url: ...
sha256: ...
patches:
- patches/fix_build.patch
- patches/fix_tests.patch # Applied in order# When meta.yaml patches aren't enough
cd $SRC_DIR
patch -p1 < ${RECIPE_DIR}/fix_something.patch
# Or for Windows in bld.bat
cd %SRC_DIR%
patch -p1 --binary < %RECIPE_DIR%\fix_something.patch# Generate recipe from PyPI
conda skeleton pypi mypackage
conda skeleton pypi mypackage --recursive # Include dependencies
conda skeleton pypi mypackage --pypi-url <mirror-url> # Custom PyPI mirror
# Generate from CPAN (Perl)
conda skeleton cpan Some::Module
# Generate from CRAN (R)
conda skeleton cran mypackage
# Then build it
conda build mypackage# Convert noarch/pure-python package to other platforms
conda convert -p all /path/to/pkg.tar.bz2 -o outputdir/
conda convert -p win-64 /path/to/pkg.tar.bz2
conda convert -p osx-arm64 /path/to/pkg.tar.bz2
conda convert -p linux-aarch64 /path/to/pkg.tar.bz2
# NOTE: only works for pure-Python packages (noarch: python)
# Compiled packages must be built natively per-platformanaconda login # Authenticate
anaconda whoami # Check current user
anaconda upload /path/to/conda-bld/linux-64/pkg.tar.bz2 # Upload package
anaconda upload pkg.tar.bz2 --label dev # Upload to 'dev' label
anaconda upload my-notebook.ipynb # Upload notebook
anaconda logout # Logout# Strict priority: first channel wins (recommended for reproducibility)
conda config --set channel_priority strict
# Flexible priority: solver can pick from any channel
conda config --set channel_priority flexible
# Disabled: version number wins regardless of channel
conda config --set channel_priority disabled# Set as default (conda >= 23.10 bundles it)
conda config --set solver libmamba
# Use once
conda install numpy --solver=libmamba
# Revert to classic
conda config --set solver classic# Pin packages to prevent updates
echo "numpy ==1.26.4" >> $CONDA_PREFIX/conda-meta/pinned
echo "python ==3.12.*" >> $CONDA_PREFIX/conda-meta/pinned
# View pins
cat $CONDA_PREFIX/conda-meta/pinnedconda clean --all # Remove unused packages, caches, tarballs
conda clean --tarballs # Remove cached package tarballs only
conda clean --packages # Remove unused packages only
conda clean --index-cache # Remove channel index cache
conda build purge # Remove old build source & artifacts
conda build purge-all # Remove ALL build artifacts
# Check disk usage
du -sh ~/miniconda/pkgs/ # Package cache
du -sh ~/miniconda/envs/ # All environments
du -sh ~/miniconda/conda-bld/ # Build artifacts# Check for vulnerable packages (jake)
conda install -y conda-forge::jake
conda list | jake ddt
# Audit a specific environment
conda list -n myenv --json | python -c "
import json, sys
pkgs = json.load(sys.stdin)
for p in pkgs:
print(f\"{p['name']}=={p['version']} ({p.get('channel', 'unknown')})\")"
# Verify package integrity
conda list --md5 # Show MD5 hashes (if available)
# Check package signatures (if signing is enabled)
conda verify /path/to/package.conda# Quick dep check for all Python versions
conda search ipython=8.3.0 --info | sed '/file name/,/timestamp/d'
# List all installed packages with their channels
conda list --show-channel-urls | column -t
# Find which package provides a file
conda package --which path/to/file
# Compare two environments
diff <(conda list -n env1 --export) <(conda list -n env2 --export)
# Find packages installed from pip (not conda)
conda list | grep pypi
# Size of all packages in env
conda list --json | python -c "
import json, sys
pkgs = json.load(sys.stdin)
print(f'Total packages: {len(pkgs)}')
"
# Export only conda packages (skip pip)
conda list --no-pip --export > conda-only.txt
# Find broken packages (missing files)
conda list --json | python -c "
import json, sys, os
pkgs = json.load(sys.stdin)
prefix = os.environ['CONDA_PREFIX']
for p in pkgs:
meta = os.path.join(prefix, 'conda-meta', f\"{p['name']}-{p['version']}*.json\")
# Check meta exists
"
# Check if a package is noarch
conda search mypackage --info 2>/dev/null | grep subdir
# Render recipe to see resolved values
conda render . 2>/dev/null | grep -E '(name|version|build):'
# Count packages per channel in environment
conda list --show-channel-urls | awk '{print $NF}' | sort | uniq -c | sort -rn
# Quick build + install cycle
conda build . --output-folder ./local && conda install -c ./local mypackage
# Run test phase only
conda build --test $(conda build . --output)# pytest: skip vs ignore
# --deselect: skips after collection (file must be importable)
# --ignore: prevents collection entirely (use when imports fail)
pytest tests/ --ignore=tests/test_gpu.py
pytest tests/ --deselect tests/test_slow.py::test_large_dataset
# Windows async flaky tests: use rerun instead of skip
pip install pytest-rerunfailures
pytest tests/ --reruns 3 --reruns-delay 1
# Run tests with reduced parallelism (for CI resource limits)
pytest tests/ -x -n auto --dist loadscope| Platform | Subdir | Compiler Triple Example |
|---|---|---|
| Linux x86_64 | linux-64 |
x86_64-conda-linux-gnu |
| Linux AArch64 | linux-aarch64 |
aarch64-conda-linux-gnu |
| Linux ppc64le | linux-ppc64le |
powerpc64le-conda-linux-gnu |
| macOS x86_64 | osx-64 |
x86_64-apple-darwin13.4.0 |
| macOS ARM64 | osx-arm64 |
arm64-apple-darwin20.0.0 |
| Windows x86_64 | win-64 |
x86_64-w64-mingw32 (MSYS2) |
Build failed?
├─ Source download/extraction failed?
│ └─ Check: sha256, url, network, proxy settings
├─ Dependency resolution failed?
│ ├─ Check: channel order, pin conflicts, solver output (-vv)
│ └─ Try: --solver=libmamba, relax pins, add missing channels
├─ Compilation failed?
│ ├─ Missing header? → Add library to host requirements
│ ├─ Undefined symbol? → Check linking order, add library to host
│ ├─ Compiler error? → Check compiler compatibility, add patches
│ └─ Cross-compile issue? → Check CMAKE_ARGS, sysroot, cross-python
├─ Linking failed?
│ ├─ macOS: Check @rpath, install_name_tool, code signing
│ ├─ Linux: Check RPATH/RUNPATH, patchelf, glibc version
│ └─ Windows: Check DLL search path, dumpbin /dependents
├─ Test failed?
│ ├─ ImportError? → Missing run dependency
│ ├─ Test-specific dep? → Add to test.requires
│ ├─ File not found? → Add to test.source_files
│ └─ Flaky? → pytest --reruns, or --ignore / --deselect
└─ Package validation failed?
├─ Overlapping files? → Check multi-output, file patterns
└─ run_exports self-dep? → Use ignore_run_exports