Documentation Index
Fetch the complete documentation index at: https://mintlify.com/conda/conda/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Theconda env export command exports a given environment’s package specifications to a file or stdout. This is essential for creating reproducible environments and sharing environment specifications with others.
This command is also available as
conda export (without the env subcommand).Syntax
Target Environment Specification
Name of environment to export. If not specified, exports the currently active environment.
Full path to environment location (i.e. prefix) to export.
Output Options
File name or path for the exported environment.
Format for the exported environment. Available formats depend on installed plugins.Common formats:
yamlorenvironment-yaml- Standard YAML format (default)jsonorenvironment-json- JSON format
- File extension (if
--fileis used) - Default to YAML
For backwards compatibility: when used without
--format and without --file, exports in JSON format.If used with --file, only affects status messages (not the export format).Channel Options
Additional channel to include in the export. Can be specified multiple times.
Do not include .condarc channels in the export.
Do not include channel names with package names in the export.
Platform Options
Target platform(s)/subdir(s) for export (e.g., linux-64, osx-64, win-64). Can be specified multiple times for multi-platform exports.
Multi-platform export is only supported by certain exporters (like environment-yaml).
Override the platforms specified in the condarc.
Package Specification Options
Build environment spec from explicit specs in history (packages you explicitly installed) rather than all packages.
Remove build specification from dependencies. This makes the export more portable across platforms.Example:
- With builds:
numpy=1.24.0=py311h1234567_0 - Without builds:
numpy=1.24.0
Output Control
Can be used multiple times. Once for INFO, twice for DEBUG, three times for TRACE.
Do not display progress bar.
Export Formats
YAML Format (Default)
The standard conda environment format:JSON Format
Structured JSON output:Examples
Export current environment to stdout
Export to a file
environment.yml in the current directory.
Export specific environment
myenv environment to a file.
Export with minimal specification
Export without build strings
Export in JSON format
Export without channels
Export for multiple platforms
Export from history without builds
Common Use Cases
Share environment with team
Share environment with team
Exact environment reproduction
Exact environment reproduction
Export with full specifications for exact reproduction:This includes all dependencies with exact versions and builds.
Cross-platform development
Cross-platform development
Export without build strings for cross-platform compatibility:
Version control
Version control
Create minimal environment file for version control:
Backup before major changes
Backup before major changes
Backup environment before updates:
CI/CD pipelines
CI/CD pipelines
Export for reproducible testing:
Export Strategies
Minimal Export
Best for: Sharing and version control
- Only explicitly installed packages
- No build strings
- Most portable
Complete Export
Best for: Exact reproduction
- All packages including dependencies
- Full version and build specs
- Platform-specific
Cross-Platform Export
Best for: Multi-platform projects
- Works across different operating systems
- No platform-specific builds
Channel-Free Export
Best for: Flexibility
- No channel specifications
- Allows conda to choose best sources
Understanding Export Options
—from-history vs Full Export
Full export (default):—no-builds Effect
With builds:Troubleshooting
Export contains too many packages
Export contains too many packages
Use
--from-history to export only explicitly installed packages:Export not working across platforms
Export not working across platforms
Remove build strings and use history:
Unknown platform error
Unknown platform error
Ensure you’re specifying valid platforms:Valid platforms: linux-64, linux-aarch64, osx-64, osx-arm64, win-64
File already exists
File already exists
The command will silently overwrite. To be safe:
Best Practices
- Version Control: Use
--from-history --no-buildsfor files in version control - Documentation: Add comments to exported YAML files to explain special packages
- Regular Updates: Export environment specifications regularly as your project evolves
- Multiple Formats: Keep both minimal and complete exports for different purposes
- Platform Specificity: Use
--platformwhen you know the target platforms
Related Commands
conda env create- Create environment from exported fileconda env update- Update environment from specificationconda list- List packages in environmentconda env list- List all environmentsconda activate- Activate environment to export