conda-pack is a utility for packaging conda environments, including all their dependencies, into a single relocatable archive (e.g., .tar.gz, .zip, .squashfs). This allows for easy redistribution and deployment of isolated Python environments across different systems. It's currently at version 0.9.1 and is actively maintained with a moderate release cadence, typically a few releases per year.
pip install conda-packVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to pack an existing conda environment into a tar.gz archive using the `conda pack` command-line tool. It first ensures a sample environment exists, then packs it to a specified output file. The `--force` flag overwrites the output if it already exists.
Ensure the Python environment where `conda-pack` is installed and executed is Python 3.9 or higher.
Install Miniconda/Anaconda or Micromamba and ensure the `conda` or `micromamba` executable is in your system's PATH before running `conda-pack`.
Pack environments on a system with the same operating system and architecture as the target deployment environment.
Consider using `--compress-level` for better compression (e.g., `gzip:9`, `zstd:19`), `--compressor zstd` (available since 0.8.1) for faster/better compression, or `--ignore-pip` to exclude pip-installed packages if they are not strictly necessary or can be reinstalled on target.
Install Miniconda or Anaconda, then ensure its `bin` directory (e.g., `~/miniconda3/bin`) is added to your system's PATH environment variable. Alternatively, use `micromamba`.
Verify the environment name or path is correct using `conda env list`. If it's a new environment, create it first using `conda create -n my_env python=X.Y ...`.
If the output file already exists, add the `--force` flag to overwrite it. Check file permissions for the output directory and ensure you have write access. Check previous error messages in the console for more specific details from `conda pack`.
Install the library using `pip install conda-pack` or `conda install conda-pack -c conda-forge` in the active environment.