Overview
Theconda env remove command removes (deletes) a conda environment and all of its installed packages. This operation is destructive and cannot be undone.
Syntax
Target Environment Specification
Name of environment to remove.
You must specify either
-n or -p to identify the environment to remove.Full path to environment location (i.e. prefix) to remove.
Protection Options
DANGEROUS. Use at your own risk. Ignore protections if the environment is frozen.
Output Options
Report all output as JSON. Suitable for using conda programmatically.
Do not ask for confirmation. Automatically answer ‘yes’ to all prompts.
Can be used multiple times. Once for INFO, twice for DEBUG, three times for TRACE.
Do not display progress bar.
Only display what would have been done without actually removing the environment.
Solver Options
Choose which solver backend to use (primarily for consistency with other commands).
Examples
Remove environment by name
myenv from the default envs directory.
Remove environment by path
Remove without confirmation
Remove frozen environment
Dry run to preview
Remove with verbose output
Remove with JSON output
Common Use Cases
Clean up old environments
Clean up old environments
Remove environments you no longer need:
Free up disk space
Free up disk space
Check environment sizes and remove large unused ones:
Remove before recreating
Remove before recreating
Remove and recreate an environment with fresh packages:
Automated cleanup in scripts
Automated cleanup in scripts
Remove temporary environments in CI/CD pipelines:
Remove corrupted environments
Remove corrupted environments
If an environment becomes corrupted, remove and recreate it:
Safety Checks
Before removing an environment, conda performs several checks:Environment must be inactive
You cannot remove the currently active environment. Deactivate it first:
Frozen environment protection
Frozen environments cannot be removed unless
--override-frozen is used.What Gets Removed
When you remove an environment, conda deletes:- All installed packages
- Python interpreter
- All conda-managed files
- Environment-specific configuration files
- Activation/deactivation scripts
- Any files in the environment directory
Troubleshooting
Cannot remove active environment
Cannot remove active environment
Deactivate the environment first:If you have stacked environments, deactivate all of them:
Environment not found
Environment not found
Verify the environment exists:Use the exact name or full path shown in the list:
Permission denied
Permission denied
If you get permission errors:
- Ensure you have write permissions to the environment directory
- Close any programs that might be using files in the environment
- On Windows, ensure no processes are running from that environment
Frozen environment protection
Frozen environment protection
If the environment is frozen:
Partial removal or errors
Partial removal or errors
If removal fails partway through:
- Try running the command again
- Manually remove the directory:
Best Practices
Export Before Removing
Save environment specifications before removal:
Verify Before Deleting
Double-check you’re removing the correct environment:
Use Dry Run First
Preview what will be removed:
Deactivate First
Always deactivate before removing:
Alternatives to Removal
Before removing an environment, consider these alternatives:Clean the environment
Update instead of recreate
Clone for backup
Related Commands
conda env create- Create a new environmentconda env export- Export environment for backupconda clean- Clean packages and caches without removing environmentconda deactivate- Deactivate environment before removalconda env list- List all environments